MCPcopy Create free account
hub / github.com/MertJSX/folderhost / adjustUTF8Position

Function adjustUTF8Position

middleware/websocket/file_editor.go:137–149  ·  view source on GitHub ↗
(lines []string, lineNum, col int)

Source from the content-addressed store, hash-verified

135}
136
137func adjustUTF8Position(lines []string, lineNum, col int) int {
138 if lineNum < 0 || lineNum >= len(lines) {
139 return col
140 }
141
142 line := lines[lineNum]
143
144 if col > utf8.RuneCountInString(line) {
145 return utf8.RuneCountInString(line)
146 }
147
148 return col
149}
150
151func applyInsert(filePath string, lines []string, lineNum, col int, text string, account *types.Account) error {
152 if lineNum < 0 || lineNum >= len(lines) {

Callers 1

applyEditorChangeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected