This commit is contained in:
Kovid Goyal
2023-03-28 11:55:08 +05:30
parent 00d4841304
commit 8867818dfe
2 changed files with 14 additions and 14 deletions

View File

@@ -91,3 +91,16 @@ func (ms *MouseSelection) LineBounds(line_pos LinePos) (start_x, end_x int) {
}
return -1, -1
}
func FormatPartOfLine(sgr string, start_x, end_x, y int) string {
// DECCARA used to set formatting in specified region using zero based indexing
return fmt.Sprintf("\x1b[%d;%d;%d;%d;%s$r", y+1, start_x+1, y+1, end_x+1, sgr)
}
func (ms *MouseSelection) LineFormatSuffix(line_pos LinePos, sgr string, y int) string {
s, e := ms.LineBounds(line_pos)
if s > -1 {
return FormatPartOfLine(sgr, s, e, y)
}
return ""
}