DEF_CMD(display_ncurses)
{
struct pane *p;
+ struct pane *ed = pane_root(ci->focus);
const char *tty = ci->str;
const char *term = ci->str2;
if (!term)
term = "xterm-256color";
- p = ncurses_init(ci->focus, tty, term);
+ p = ncurses_init(ed, tty, term);
if (p)
p = call_ret(pane, "editor:activate-display", p);
+ if (p && ci->focus != ed)
+ /* Assume ci->focus is a document */
+ p = home_call_ret(pane, ci->focus, "doc:attach-view", p, 1);
if (p)
return comm_call(ci->comm2, "callback:display", p);
DEF_CMD(display_xcb)
{
struct pane *p;
+ struct pane *ed = pane_root(ci->focus);
const char *d = ci->str;
if (!d)
return Enoarg;
- p = xcb_display_init(d, ci->str2, ci->focus);
+ p = xcb_display_init(d, ci->str2, ed);
+ if (p && ci->focus != ed)
+ /* Assume ci->focus is a document */
+ p = home_call_ret(pane, ci->focus, "doc:attach-view", p, 1);
if (p)
return comm_call(ci->comm2, "cb", p);
return Efail;
if (term) {
char *TERM = getenv("TERM");
- p = call_ret(pane, "attach-display-ncurses", ed,
+ p = call_ret(pane, "attach-display-ncurses", doc,
0, NULL, "-", 0, NULL, TERM);
if (p) {
char *e;
0, NULL, getenv("DISPLAY"));
call("window:set:XAUTHORITY", p,
0, NULL, getenv("XAUTHORITY"));
- }
- if (p)
- p = home_call_ret(pane, doc, "doc:attach-view",
- p, 1);
- if (!first_window)
- first_window = p;
- if (p)
+ if (!first_window)
+ first_window = p;
call("Display:set-noclose", p, 1, NULL,
"Cannot close primary display");
+ }
}
if (gtk) {
p = call_ret(pane, "attach-display-gtk",
- ed, 0, NULL, getenv("DISPLAY"));
- if (p)
- p = home_call_ret(pane, doc, "doc:attach-view",
- p, 1);
+ doc, 0, NULL, getenv("DISPLAY"));
if (!first_window)
first_window = p;
}
if (x11) {
p = call_ret(pane, "attach-display-x11",
- ed, 0, NULL, getenv("DISPLAY"),
+ doc, 0, NULL, getenv("DISPLAY"),
0, NULL, getenv("XAUTHORITY"));
- if (p)
- p = home_call_ret(pane, doc, "doc:attach-view",
- p, 1);
if (!first_window)
first_window = p;
}
if not str1:
return None
focus.call("attach-glibevents")
+ ed = focus.root
if 'SCALE' in os.environ:
sc = int(os.environ['SCALE'])
disp = EdDisplay(focus, str1)
p = disp.call("editor:activate-display", ret='pane')
+ if p and focus != ed:
+ p = focus.call("doc:attach-view", p, 1)
comm2('callback', p)
return 1