Explorar el Código

use relative line numbers

Johan Rong hace 1 semana
padre
commit
939313197d
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      internal/editor/draw.go

+ 3 - 1
internal/editor/draw.go

@@ -220,7 +220,9 @@ func (m *Model) DrawBuffer(buf *buffer.Buffer, isActive bool, rect layout.Rect)
 	for j, line := range table {
 		if j + 1 > rect.Height { break }
 
-		nums := fmt.Sprintf("%4d ", j + buf.TopLine)
+		lineNum := j + buf.TopLine
+		relLine := lineNum - curLine
+		nums := fmt.Sprintf("%4d ", relLine)
 		r := []rune(nums + expandTabs(line))
 		if len(r) + 1 > rect.Width {
 			r = r[:rect.Width]