-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Reimplement builtin terminal UI with termkey/unibilium #1820
Conversation
:) |
@@ -4,6 +4,7 @@ | |||
/.deps/ | |||
/tmp/ | |||
|
|||
*.i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the build put *.i
files in the build/
subdirectories (in which case, ignoring them here wouldn't be necessary)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Nice line count of this PR. 👍 Segfaults for the moment with my nvimrc tho, but with |
Not sure if helpful, but all craches ends with
It crashes on resize and at random times it decides to resize itself (e.g. when doing cmdline completion) with the aforementioned result. |
This ui doesn't seem to work correctly with terminology (https://www.enlightenment.org/p.php?p=about/terminology) and from my limited testing neither did pynvim. The problem seem to have to do with getting the correct terminal width. The first letter of every sentence starts at the end of the line and then wraps around. Might be a tickit issue I guess (@leonerd)? |
@@ -189,8 +192,14 @@ list(APPEND NVIM_LINK_LIBRARIES | |||
${LIBUV_LIBRARIES} | |||
${MSGPACK_LIBRARIES} | |||
${LUAJIT_LIBRARIES} | |||
"-Wl,--whole-archive" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is failing to build on Mac OS X:
ld: unknown option: --whole-archive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should add that the error above is on Yosemite where it is using LLVM's linker. Mavericks is probably a different story, but FreeBSD may fail as well. There is a -all_load
, but the corresponding -noall_load
is obsolete. Turns out -all_load
affects all static archives. :-( There is also a -force_load LIBRARY
, but detecting the presence of the option at build time is kind of a pain since it requires an archive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I don't understand why this flag is necessary for libtickit & dependencies, I've used it before but only for building shared libraries that include other static libraries. Do you know a another way of avoiding missing reference errors during link stage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just reverse the order to:
${LIBTICKIT_LIBRARIES}
${LIBTERMKEY_LIBRARIES}
${LIBUNIBILIUM_LIBRARIES}
And it is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just reverse the order to:
👍 great, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to understand why the change in order was necessary. Is it because unibilium/termkey are skipped when it determines none of its symbols are directly used by the nvim binary? If so then it actually makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because linking is very linear. In this case, libtickit depends on both libtermkey and libunibilium. If you link libtickit last, then those functions won't be resolved again (because they were present in previous libraries). However, if you change the order so that libtickit gets linked first, then the linker knows about the unresolved functions in libtickit can fix them up correctly when libtermkey and libunibilium are linked in next.
In general, you want the objects with the most dependencies to be linked in first, and the objects with no dependencies linked in last. And you want to make sure to link the dependencies in after the object that requires them. What you are really doing is a topological sort. :-)
I'm just getting started, I think this PR will remove more than 7k lines :)
Could be what @oni-link spotted, I will investigate. |
fa82072
to
a1daf73
Compare
2fc8cf1
to
0c64a89
Compare
👍 Will investigate. Some legacy functional tests are failing, but the UI should be as stable as the python version. |
Is it possible to get the libtickit/libtermkey changes into upstream before this is merged into master? I ask because e.g. Arch Linux will need to package these libraries, and first introducing a special |
👍. Don't worry as this will only be merged when all tests are fixed and the changes are sent back to @leonerd. Did you get a chance to test this branch? How stable is it for you? |
I had to check |
Nice, if you don't mind please keep using it. This PR introduces some serious architectural changes and the more people are testing it the better. I'm interested in knowing this branch deals with troubling key mappings. One of the compelling reasons I choose libtickit/libtermkey is because it is capable of understanding an encoding scheme that uniquely identifies each key(though I'm not sure if some special terminal configuration is required for that) |
// setup libtickit | ||
data->tt = tickit_term_new(); | ||
tickit_term_set_input_fd(data->tt, data->in_fd); | ||
tickit_term_set_output_fd(data->tt, data->in_fd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data->out_fd
instead of data->in_fd
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
char buf[64]; | ||
|
||
if (type == TICKIT_KEYEV_KEY) { | ||
if (!strcmp("BackSpace", str)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be Backspace
instead of BackSpace
.
I realized a small problem with the shell output. Unlike the pynvim ui it is extremely fast which is awesome but the the background color is wrong. Only the text has background color of the colorscheme but the part without text is black. |
I'm not entirely through the code yet, but where did input encoding go? (the removed lines in os/input.c). |
I've removed it, the |
Ok, this is as ready as its gonna get, merging after the tests. @elmart as soon as you identify a pattern for reproducing the YCM slowdown, I will investigate and hopefully come up with a fix soon |
Great job! |
The `wait` function will only return after all input has been processed by nvim. It is useful to time assertions correctly.
Without waiting for the 'gg' command to be processed, its possible that the following assertion will fail.
The `system` function is never executed with these tests because the ctrl+c is queued with the input string that calls it(The `process_interrupts` function will destroy all previous input when a ctrl+c is found).
Some screen tests such as system/ctrl+c(viml_system_spec.lua) can take some time to respond(default kill timeout is 2 seconds for an interrupted job) and fail when running under a slow environment such as travis.
This is required to correctly handle certain keys such as <delete>
Ignore all keys that aren't prefixed with KS_EXTRA.
The input buffer is only used for data that really came from another process and is only visible to os/input.c. Remove the input_buffer_{save,restore} functions, they are not necessary(Also can result in problems if data comes while the typeahead is saved).
- Remove abstract_ui global, now it is always active - Remove some terminal handling code - Remove unused functions - Remove HAVE_TGETENT/TERMINFO/TERMIOS/IOCTL #ifdefs - Remove tgetent/terminfo from version.c - Remove curses/terminfo dependencies - Only start/stop termcap when starting/exiting the program - msg_use_printf will return true if there are no attached UIs( messages will be written to stdout) - Remove `ex_winpos`(implement `:winpos` with `ex_ni`)
Now all terminal-handling code was moved to src/nvim/tui, which implements a new terminal UI based on libtermkey and unibilium
Now the attrentry_T structure will store all attributes in separate fields for cterm and rgb UIs.
- The syntax `gui=` is invalid when setting properties of highlight group. - Wait for the initial "-- More --" prompt before continuing. Required to avoid a race condition
Hi, using the merged version, there're still a problem that the terminal's background color cannot be automatically "resetted". To repeat this bug, |
Please report in a new issue. |
Ok. Really great work, @tarruda. Thumbs up! 👍 |
This PR will throw a lot of old code into the garbage can.