Skip to content

Conversation

@cutelisp
Copy link
Contributor

@cutelisp cutelisp commented Jul 24, 2025

As #1182 suggests, Micro currently lacks horizontal scrolling. This is my first approach to implementing it, but I’d like some feedback:

  1. Is there any reliable keybinding (perhaps modekey+scroll) that we could use by default? As mentioned here, we could implement this without a default keybind, but I think it would be neat to have one.

  2. Does this justify a new option, or could we unify it with scrollspeed?

  3. From what I’ve seen, editors allow horizontal scrolling when there is a line longer than the buffer’s width, but they also include a margin.
    For example, even if the longest line is shorter than bufwidth - margin, scrolling is still possible. Similarly, there is often a margin for how far we can scroll past the end of the longest line.
    Should we have such margins? (In my current implementation, I called this OFFSET.)

  4. Similar to scrollmargin, ideally, Micro could have a horizontalscrollmargin? i.e. when typing continuously, the cursor would always stay at least n cells away from the right edge, preventing it from touching the border. If so it could be the value used for the margin of question 3.

Feedback on the actual implementation is also appreciated.
Currently, there’s a bug when deleting characters within the longest line.
It happens because of this.
Example: Create a line longer than bufWidth, place your cursor at the last character, and start deleting. Shouldn’t the view shift to the left automatically as the line becomes shorter?

@Andriamanitra
Copy link
Contributor

Is there any reliable keybinding (perhaps modekey+scroll) that we could use by default?

It's a pretty niche feature so I don't think it makes sense for us to invent a completely new default keybinding for it (even if it would be more reliable). MouseWheelLeft/MouseWheelRight and ShiftMouseWheelUp/ShiftMouseWheelDown may not work in all environments but they would still be good to have as a default because they are the most common keybindings used for horizontal scrolling.

@Neko-Box-Coder
Copy link
Contributor

Nice, glad to see there's horizontal scroll be implemented. This is always something slightly annoying me but not enough for me to go and implement one 😅

  1. Is there any reliable keybinding (perhaps modekey+scroll) that we could use by default? As mentioned here, we could implement this without a default keybind, but I think it would be neat to have one.

I think we should keep the default binding consistent with its counterpart, i.e. Mouse wheel right and left, as @Andriamanitra suggested.

2. Does this justify a new option, or could we unify it with scrollspeed?

4. Similar to scrollmargin, ideally, Micro could have a horizontalscrollmargin?

I think these two should be consistent together, i.e. if we add a horizontal option in margin, we should add to scrolling as well. And yes I think we should add a dedicated option for horizontal. (and potentially default back to the non-horizontal counterpart if not set in the user config. But this might be difficult to implement, idk)

I can see use-cases where an user want the horizontal scrolling to be lower than vertical one, or vice versa.

3. From what I’ve seen, editors allow horizontal scrolling when there is a line longer than the buffer’s width, but they also include a margin.
...
Should we have such margins? (In my current implementation, I called this OFFSET.)

Yes, I think we should.

A question I have is, should we add a scrollbar to this, i.e. be able to see where the viewport is horizontally and how much you need to scroll. I don't really mind personally having one or not but curious to see others' opinions.

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