Use the new string scanner everywhere
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
package ask
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"kitty/tools/cli/markup"
|
||||
@@ -323,7 +322,7 @@ func choices(o *Options) (response string, err error) {
|
||||
return err
|
||||
}
|
||||
if message != "" {
|
||||
scanner := bufio.NewScanner(strings.NewReader(message))
|
||||
scanner := utils.NewLineScanner(message)
|
||||
for scanner.Scan() {
|
||||
msg_lines = draw_long_text(int(sz.WidthCells), scanner.Text(), msg_lines)
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
package completion
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
@@ -71,7 +69,7 @@ func complete_themes(completions *cli.Completions, word string, arg_num int) {
|
||||
out, err := exec.Command(kitty, "+runpy", "from kittens.themes.collection import *; print_theme_names()").Output()
|
||||
if err == nil {
|
||||
mg := completions.AddMatchGroup("Themes")
|
||||
scanner := bufio.NewScanner(bytes.NewReader(out))
|
||||
scanner := utils.NewLineScanner(utils.UnsafeBytesToString(out))
|
||||
for scanner.Scan() {
|
||||
theme_name := strings.TrimSpace(scanner.Text())
|
||||
if theme_name != "" && strings.HasPrefix(theme_name, word) {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
package hyperlinked_grep
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -42,7 +41,7 @@ func get_options_for_rg() (expecting_args map[string]bool, alias_map map[string]
|
||||
err = fmt.Errorf("Failed to execute rg: %w", err)
|
||||
return
|
||||
}
|
||||
scanner := bufio.NewScanner(strings.NewReader(utils.UnsafeBytesToString(raw)))
|
||||
scanner := utils.NewLineScanner(utils.UnsafeBytesToString(raw))
|
||||
options_started := false
|
||||
expecting_args = make(map[string]bool, 64)
|
||||
alias_map = make(map[string]string, 52)
|
||||
|
||||
Reference in New Issue
Block a user