mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-20 02:57:19 +03:00
More work on unicode input
This commit is contained in:
parent
fb66cbc792
commit
a5eac42d92
@ -163,9 +163,9 @@ type handler struct {
|
||||
}
|
||||
|
||||
func (self *handler) initialize() {
|
||||
self.ctx.AllowEscapeCodes = true
|
||||
self.table.initialize(self.emoji_variation, self.ctx)
|
||||
self.lp.SetWindowTitle("Unicode input")
|
||||
self.ctx.AllowEscapeCodes = true
|
||||
self.current_char = InvalidChar
|
||||
self.current_tab_formatter = self.ctx.SprintFunc("reverse=false bold=true")
|
||||
self.tab_bar_formatter = self.ctx.SprintFunc("reverse=true")
|
||||
@ -330,15 +330,25 @@ func (self *handler) draw_screen() {
|
||||
defer self.lp.RestoreCursorPosition()
|
||||
writeln()
|
||||
writeln(self.choice_line)
|
||||
sz, _ := self.lp.ScreenSize()
|
||||
|
||||
write_help := func(x string) {
|
||||
lines := style.WrapTextAsLines(x, "", int(sz.WidthCells)-1)
|
||||
wx := lines[0]
|
||||
if len(lines) > 1 {
|
||||
wx += "…"
|
||||
}
|
||||
writeln(self.dim_formatter(wx))
|
||||
}
|
||||
|
||||
switch self.mode {
|
||||
case HEX:
|
||||
writeln(self.dim_formatter(fmt.Sprintf("Type %s followed by the index for the recent entries below", INDEX_CHAR)))
|
||||
write_help(fmt.Sprintf("Type %s followed by the index for the recent entries below", INDEX_CHAR))
|
||||
case NAME:
|
||||
writeln(self.dim_formatter(fmt.Sprintf("Use Tab or arrow keys to choose a character. Type space and %s to select by index", INDEX_CHAR)))
|
||||
write_help(fmt.Sprintf("Use Tab or arrow keys to choose a character. Type space and %s to select by index", INDEX_CHAR))
|
||||
case FAVORITES:
|
||||
writeln(self.dim_formatter("Press F12 to edit the list of favorites"))
|
||||
write_help("Press F12 to edit the list of favorites")
|
||||
}
|
||||
sz, _ := self.lp.ScreenSize()
|
||||
q := self.table.layout(int(sz.HeightCells)-y, int(sz.WidthCells))
|
||||
if q != "" {
|
||||
self.lp.QueueWriteString(q)
|
||||
|
@ -61,7 +61,7 @@ type table struct {
|
||||
num_cols, num_rows int
|
||||
mode Mode
|
||||
|
||||
green, reversed, not_reversed, intense_gray func(...any) string
|
||||
green, reversed, intense_gray func(...any) string
|
||||
}
|
||||
|
||||
func (self *table) initialize(emoji_variation string, ctx style.Context) {
|
||||
@ -70,7 +70,6 @@ func (self *table) initialize(emoji_variation string, ctx style.Context) {
|
||||
self.last_cols, self.last_rows = -1, -1
|
||||
self.green = ctx.SprintFunc("fg=green")
|
||||
self.reversed = ctx.SprintFunc("reverse=true")
|
||||
self.not_reversed = ctx.SprintFunc("reverse=false")
|
||||
self.intense_gray = ctx.SprintFunc("fg=intense-gray")
|
||||
}
|
||||
|
||||
@ -149,8 +148,6 @@ func (self *table) layout(rows, cols int) string {
|
||||
}
|
||||
if is_current {
|
||||
text = self.reversed(text)
|
||||
} else {
|
||||
text = self.not_reversed(text)
|
||||
}
|
||||
output.WriteString(text)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user