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
Horizontal Scrolling #3450
Horizontal Scrolling #3450
Conversation
Added support for horizontal scrolling. The code comes from the original vim source. Removed the check for `guioptions` as Neovim does not have support for that setting. Including a test for `<ScrollWheelLeft>` and `<ScrollWheelRight>` in `mouse_spec.lua`.
Lint errors. Also, functions without parameters require (void). |
col = 0; | ||
if (*p != NUL) | ||
for (;;) | ||
{ |
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 if statement is very ambiguous
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.
That is the way that it is written in the VIM source. If necessary, I can modify it to be less ambiguous but I tried to leave the code as close as possible to the original.
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.
@bambu “As close as possible” is a bad idea. We have different code style.
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 on the same line as for
.
Is there any action needed that is preventing this from being merged? |
@@ -7620,6 +7620,15 @@ static void ins_mousescroll(int dir) | |||
(long)(curwin->w_botline - curwin->w_topline)); | |||
else | |||
scroll_redraw(dir, 3L); | |||
} else { | |||
int val, step = 6; |
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.
Split the definition.
static linenr_T longest_lnum; | ||
/* | ||
* Do a horizontal scroll. Return TRUE if the cursor moved, FALSE otherwise. | ||
*/ |
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.
///
Linter is close to useless here. |
Bump. This would be a really awesome addition to neovim. |
/// | ||
/// Do a horizontal scroll. Return TRUE if the cursor moved, FALSE otherwise. | ||
/// | ||
int gui_do_horiz_scroll(int leftcol, bool compute_longest_lnum) |
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 and the other 2 new functions can be moved to mouse.c
after adding these includes to mouse.c:
#include "nvim/memline.h"
#include "nvim/charset.h"
Removed 'gui_' from the function names, as well as the guioptions comment. Renamed variables to be more specific (as opposed to generic p, w). Made single use functions static
@justinmk Made the requested updates. |
@bambu LGTM, thanks for followup! Merged w/ squash. |
- Code from Vim source. - Removed the check for 'guioptions' - mouse_spec.lua: test <ScrollWheelLeft> and <ScrollWheelRight> - Move horizontal scroll logic to mouse.c - Remove 'gui_' from the function names - Renamed variables to be more specific (as opposed to generic p, w). - Marked some functions as `static`
Features: c7d84c5 PR #4980 Full `:ruby` support! c74ce33 PR #4624 timers: timer_start(), timer_stop() b8e6f04 PR #5205 `:CheckHealth` command 47a15d0 PR #4865 file: Add buffered reading and writing *Much* faster shada file reading (important for startup time). 71b3e20 PR #4723 jobstart() learned 'rpc' jobs and RPC channel IDs share the same "namespace". jobstart() can starts RPC channels, which allows scripts to handle 'stderr' on a RPC channel, like a typical non-RPC job. jobpid()/jobstop() work on RPC "jobs". Deprecates rpcstart(). 4dc4efc PR #4449 man.vim rewrite `:Man` command is enabled by default. New features: completion, window handling, better parsing, and more. 8a4e5b4 PR #4697 capture() function (renamed to execute()) Supports nesting, including nested :redir. ae6db26 PR #5050 'rplugin manifest: default to XDG dir' a168228 PR #5214 Restore ":browse oldfiles". 1f7304b Better handling of mouse-clicks on concealed chars. 5ea4d58 PR #5026 terminal: Ensure b:term_title always has a value c002310 tui: Assume 256 colors in most cases. a2ecbc2 PR #4929 Always resize the :terminal a59330d PR #4925 api_info() a160590 PR #4813 allow setting cwd in jobstart(), termopen() 74f6460 PR #4633: support "special" highlight (undercurl) 5a5ef1c PR #3450 mouse: Implement horizontal scroll. Windows support: All PRs now build on Appveyor targeting win32 and win64! Numerous fixes! Fixes: e906111 PR #4646 Prevent data loss for process output streams 7fa1baf PR #4798 'process.c: Fix block in teardown' c10fe01 Prevent endless loop in printdigraph(). (#5215) add41dc PR #5192 timers: Avoid crash after processing events 006f9c0 PR #5195 Set the default value for 'packpath' 6da7d68 PR #5025 Restore double click d622e9c readfile(): Less-disruptive readonly check. Fixes an issue where nvim unnecessarily "touched" open files. fe6ec75 PR #4964 Handle very long $XDG_DATA_DIRS. 895f712 option: Do not expand options in XDG vars. 1d8a076 server_init: Handle server_address_new() failure. be531ab PR #5042 Fix v:register for clipboard=unnamed,unnamedplus 204f557 PR #4984 'Trigger TabNewEntered with <CTRL-W>T' 1e93e24 PR #4851 synIDattr(): Return RRGGBB value for `fg#`. Changes: acc5d08 PR #4690 'termguicolors' option enables "true color". NVIM_TUI_ENABLE_TRUE_COLOR is now ignored.
Added support for horizontal scrolling. The code comes from the original
vim source. Removed the check for
guioptions
as Neovim does not havesupport for that setting. Including a test for
<ScrollWheelLeft>
and<ScrollWheelRight>
inmouse_spec.lua
.This PR is for #3440.