Skip to content

Conversation

justinmk
Copy link
Member

@justinmk justinmk commented Oct 5, 2017

The behavior is different (simpler) compared to Vim.

nateozem and others added 2 commits October 5, 2017 09:18
- default 'titleold' to empty
- set title on exit if 'title' is enabled and 'titleold' is non-empty
- update docs
@nateozem
Copy link
Contributor

nateozem commented Oct 5, 2017

it works out. It's very simple. I was bit confuse of how to set the terminal title since Vim was doing its way and partially following the documentation.

From testing your changes, I don't see any problems.

@justinmk justinmk merged commit 01487d4 into neovim:master Oct 5, 2017
@justinmk justinmk deleted the titleold branch October 5, 2017 19:49
ui_call_set_title(cstr_as_string((char *)lasttitle));
ui_call_set_icon(cstr_as_string((char *)lasticon));
ui_flush();
if (p_icon) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These conditions should be in the TUI not here, it breaks other UIs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought these options applied to all UIs. It just raises UI events, how does it break them?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a terminal it makes sense to either set the title or retain the old title (set by the emulator or the shell). For the UI it makes no sense as there is no "old title" to override/reset. vim handles this relatively reasonably by setting 'title' by default in gvim, but not (necessarily) in terminal vim. But as nvim can't let the default be affected by the ui/terminal type one way is to let UIs always get the title, but let the TUI be controlled by default-off option.

Alternatively, we could set title by default also in TUI, but I have no idea how many issues opened by upset users that would lead to.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, got it. We didn't have these conditions before, so we could just default title=on , right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After checking, we already have them in maketitle(), so these conditions are redundant. (and master before this doesn't set terminal title with -u NONE) . So the question still stands. Personally I'm perfectly fine with set title by default, but if guicursor is any precedent, prepare for responses like "nvim set the title and didn't restore it, it broke my terminal setup". Your call, I guess you will be the one responding to them. :) But there is a third way, we can hack the vim behavior a simpler way; if nvim is started with --headless or --embed, then set title by default.

Copy link
Member Author

@justinmk justinmk Oct 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have them in maketitle(), so these conditions are redundant

But resettitle() is not only called from maketitle().

Vim doesn't have these conditions in resettitle, it only calls mch_settitle, which is driven by the state of lasttitle/lasticon, which are set by maketitle(). mch_settitle() doesn't exist in Nvim, it was replaced by ui_call_set_*, i.e., it's delegated to the UI.

I actually don't know what the implications of the conditions are, and if it works ok without them (edit: it does; checked with all combinations of 'title', 'titlestring', 'titleold'), might as well remove them as they were before. The logic is just crazy.

@@ -3069,9 +3069,13 @@ static bool ti_change(char_u *str, char_u **last)
/// Set current window title
void resettitle(void)
Copy link
Member Author

@justinmk justinmk Oct 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nateozem what was the reason for changing this function at all?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made logical reasoning with the old commit from 486d2e9 commit where I follow the logic of did_set_title. From reviewing the changes, I shouldn't place that logic in resettitle. I think because I didn't know if I would have access to variables like p_title and lasttitle.
My intention were, don't update if there is nothing that needs to be updated.

justinmk added a commit to justinmk/neovim that referenced this pull request Oct 7, 2017
These conditions were added in neovim#7358 for no apparent reason.

ref neovim#7358 (comment)
justinmk added a commit that referenced this pull request Oct 7, 2017
These conditions were added in #7358 for no apparent reason.

ref #7358 (comment)
justinmk added a commit to justinmk/neovim that referenced this pull request Nov 8, 2017
FEATURES:
0e873a3 Lua(Jit) built-in neovim#4411
5b32bce Windows: `:terminal` neovim#7007
7b0ceb3 UI/API: externalize cmdline neovim#7173
b67f58b UI/API: externalize wildmenu neovim#7454
b23aa1c UI: 'winhighlight' neovim#6597
17531ed UI: command-line coloring (`:help input()-highlight`) neovim#6364
244a1f9 API: execute lua directly from the remote api neovim#6704
45626de API: `get_keymap()` neovim#6236
db99982 API: `nvim_get_hl_by_name()`, `nvim_get_hl_by_id()` neovim#7082
dc68538 menu_get() function neovim#6322
9db42d4 :cquit : take an error code argument neovim#7336
9cc185d job-control: serverstart(): support ipv6 neovim#6680
1b7a9bf job-control: sockopen() neovim#6594
6efe84a clipboard: fallback to tmux clipboard neovim#6894
6016ac2 clipboard: customize clipboard with `g:clipboard` neovim#6030
3a86dd5 ruby: override ruby host via `g:ruby_host_prog` neovim#6841
16cce1a debug: $NVIM_LOG_FILE neovim#6827
0cba3da `:checkhealth` built-in, validates $VIMRUNTIME neovim#7399

FIXES:
105d680 TUI: more terminals, improve scroll/resize neovim#6816
cb912a3 :terminal : handle F1-F12, other keys neovim#7241
619838f inccommand: improve performance neovim#6949
04b3c32 inccommand: Fix matches for zero-width neovim#7487
60b1e8a inccommand: multiline, other fixes neovim#7315
f1f7f3b inccommand: Ignore leading modifiers in the command neovim#6967
1551f71 inccommand: fix 'gdefault' lockup neovim#7262
6338199 API: bufhl: support creating new groups neovim#7414
541dde3 API: allow K_EVENT during operator-pending
8c732f7 terminal: adjust for 'number' neovim#7440
5bec946 UI: preserve wildmenu during jobs/events neovim#7110
c349083 UI: disable 'lazyredraw' during ui_refresh. neovim#6259
51808a2 send FocusGained/FocusLost event instead of pseudokey neovim#7221
133f8bc shada: preserve unnamed register on restart neovim#4700
1b70a1d shada: avoid assertion on corrupt shada file neovim#6958
9f534f3 mksession: Restore tab-local working directory neovim#6859
de1084f fix buf_write() crash neovim#7140
7f76986 syntax: register 'Normal' highlight group neovim#6973
6e7a8c3 RPC: close channel if stream was closed neovim#7081
85f3084 clipboard: disallow recursion; show hint only once neovim#7203
8d1ccb6 clipboard: performance, avoid weird edge-cases neovim#7193
01487d4 'titleold' neovim#7358
01e53a5 Windows: better path-handling, separator (slash) hygiene neovim#7349
0f2873c Windows: multibyte startup arguments neovim#7060

CHANGES:
9ff0cc7 :terminal : start in normal-mode neovim#6808
032b088 lower priority of 'cursorcolumn', 'colorcolumn' neovim#7364
2a3bcd1 RPC: Don't delay notifications when request is pending neovim#6544
023f67c :terminal : Do not change 'number', 'relativenumber' neovim#6796
1ef2d76 socket.c: Disable Nagle's algorithm on TCP sockets neovim#6915
6720fe2 help: `K` tries Vim help instead of manpage neovim#3104
7068370 help, man.vim: change "outline" map to `gO` neovim#7405
@justinmk justinmk mentioned this pull request Nov 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants