mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-25 18:07:07 +09:00
Fix horizontal scrolling with a wide rune at the right edge of window
This commit is contained in:
@@ -208,12 +208,17 @@ func (w *BufWindow) Relocate() bool {
|
|||||||
// horizontal relocation (scrolling)
|
// horizontal relocation (scrolling)
|
||||||
if !b.Settings["softwrap"].(bool) {
|
if !b.Settings["softwrap"].(bool) {
|
||||||
cx := activeC.GetVisualX()
|
cx := activeC.GetVisualX()
|
||||||
|
rw := runewidth.RuneWidth(activeC.RuneUnder(activeC.X))
|
||||||
|
if rw == 0 {
|
||||||
|
rw = 1 // tab or newline
|
||||||
|
}
|
||||||
|
|
||||||
if cx < w.StartCol {
|
if cx < w.StartCol {
|
||||||
w.StartCol = cx
|
w.StartCol = cx
|
||||||
ret = true
|
ret = true
|
||||||
}
|
}
|
||||||
if cx+w.gutterOffset+1 > w.StartCol+w.Width {
|
if cx+w.gutterOffset+rw > w.StartCol+w.Width {
|
||||||
w.StartCol = cx - w.Width + w.gutterOffset + 1
|
w.StartCol = cx - w.Width + w.gutterOffset + rw
|
||||||
ret = true
|
ret = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user