Fix searching in full title lines
This commit is contained in:
parent
0a8fc3f17c
commit
7b16132b75
@ -18,6 +18,7 @@ type LineType int
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
TITLE_LINE LineType = iota
|
TITLE_LINE LineType = iota
|
||||||
|
FULL_TITLE_LINE
|
||||||
CHANGE_LINE
|
CHANGE_LINE
|
||||||
HUNK_TITLE_LINE
|
HUNK_TITLE_LINE
|
||||||
IMAGE_LINE
|
IMAGE_LINE
|
||||||
@ -112,6 +113,7 @@ func title_lines(left_path, right_path string, columns, margin_size int, ans []*
|
|||||||
left_name, right_name := path_name_map[left_path], path_name_map[right_path]
|
left_name, right_name := path_name_map[left_path], path_name_map[right_path]
|
||||||
name := ""
|
name := ""
|
||||||
m := strings.Repeat(` `, margin_size)
|
m := strings.Repeat(` `, margin_size)
|
||||||
|
ll := LogicalLine{line_type: TITLE_LINE, src: Reference{path: left_path, linenum: 0}}
|
||||||
if right_name != "" && right_name != left_name {
|
if right_name != "" && right_name != left_name {
|
||||||
n1 := fit_in(m+sanitize(left_name), columns/2-margin_size)
|
n1 := fit_in(m+sanitize(left_name), columns/2-margin_size)
|
||||||
n1 = place_in(n1, columns/2)
|
n1 = place_in(n1, columns/2)
|
||||||
@ -120,8 +122,8 @@ func title_lines(left_path, right_path string, columns, margin_size int, ans []*
|
|||||||
name = n1 + n2
|
name = n1 + n2
|
||||||
} else {
|
} else {
|
||||||
name = place_in(m+sanitize(left_name), columns)
|
name = place_in(m+sanitize(left_name), columns)
|
||||||
|
ll.line_type = FULL_TITLE_LINE
|
||||||
}
|
}
|
||||||
ll := LogicalLine{line_type: TITLE_LINE, src: Reference{path: left_path, linenum: 0}}
|
|
||||||
l1 := ll
|
l1 := ll
|
||||||
l1.screen_lines = []string{title_format(name)}
|
l1.screen_lines = []string{title_format(name)}
|
||||||
l2 := ll
|
l2 := ll
|
||||||
|
|||||||
@ -80,7 +80,7 @@ func (self *Search) find_matches_in_line(line *LogicalLine, margin_size, cols in
|
|||||||
lt := line.line_type
|
lt := line.line_type
|
||||||
for i, line := range line.screen_lines {
|
for i, line := range line.screen_lines {
|
||||||
line = wcswidth.StripEscapeCodes(line)
|
line = wcswidth.StripEscapeCodes(line)
|
||||||
if lt == HUNK_TITLE_LINE {
|
if lt == HUNK_TITLE_LINE || lt == FULL_TITLE_LINE {
|
||||||
if len(line) > margin_size {
|
if len(line) > margin_size {
|
||||||
left_clean_lines[i] = line[margin_size:]
|
left_clean_lines[i] = line[margin_size:]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user