After commit c018f5fd29 Fenrir is being switched over to go. If you do not want to be part of the testing process, please switch to master.
This commit is contained in:
1 parent
c018f5fd29
commit
0e50de4c76
1047 files changed
+58364
-63747
No files matched your search
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2026 Storm Dragon
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package presentation
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"unicode"
|
||||
|
||||
"git.stormux.org/storm/fenrir/internal/i18n"
|
||||
)
|
||||
|
||||
// Indentation_level counts leading visible whitespace cells. Terminal backends
|
||||
// normally expand tabs already; a literal tab advances to the next 8-cell stop.
|
||||
// Blank rows have no meaningful indentation, including terminal padding.
|
||||
func Indentation_level(line []rune) (int, bool) {
|
||||
level := 0
|
||||
for _, char := range line {
|
||||
if !unicode.IsSpace(char) {
|
||||
return level, true
|
||||
}
|
||||
if char == '\t' {
|
||||
level += 8 - level%8
|
||||
} else {
|
||||
level++
|
||||
}
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
|
||||
func Indentation_message(level int, mode string) Message {
|
||||
message := Message{Text: i18n.T("indented ") + strconv.Itoa(level) + " "}
|
||||
if mode == "beeps" || mode == "both" {
|
||||
message.Indentation = &Indentation{Level: level, Speech: mode == "both"}
|
||||
}
|
||||
return message
|
||||
}
|
||||
Reference in new issue
Block a user