refactor: improve variable naming for better readability

- Rename `cv` to `chatView` in chatview constructor
- Rename `bm` to `bitmap` in QR code rendering
- Rename `n` to `notification` in desktop notifications
- Rename `p` to `padding` in UI configuration

These changes make the code more self-documenting and easier to understand by using descriptive variable names instead of abbreviated ones.
This commit is contained in:
ayn2op 2025-12-15 03:19:00 -05:00
parent 9b83d85f7e
commit bed98bec76
4 changed files with 17 additions and 17 deletions

View file

@ -35,7 +35,7 @@ type chatView struct {
}
func newChatView(app *tview.Application, cfg *config.Config) *chatView {
cv := &chatView{
chatView := &chatView{
Pages: tview.NewPages(),
mainFlex: tview.NewFlex(),
@ -49,10 +49,10 @@ func newChatView(app *tview.Application, cfg *config.Config) *chatView {
cfg: cfg,
}
cv.SetInputCapture(cv.onInputCapture)
chatView.SetInputCapture(chatView.onInputCapture)
cv.buildLayout()
return cv
chatView.buildLayout()
return chatView
}
func (cv *chatView) buildLayout() {

View file

@ -363,14 +363,14 @@ func renderQR(content string) (string, error) {
if err != nil {
return "", err
}
bm := code.Bitmap()
bitmap := code.Bitmap()
var b strings.Builder
for y := 0; y < len(bm); y += 2 {
for x := range bm[y] {
top := bm[y][x]
for y := 0; y < len(bitmap); y += 2 {
for x := range bitmap[y] {
top := bitmap[y][x]
bottom := false
if y+1 < len(bm) {
bottom = bm[y+1][x]
if y+1 < len(bitmap) {
bottom = bitmap[y+1][x]
}
if top && bottom {
b.WriteString("█")

View file

@ -7,13 +7,13 @@ import (
)
func sendDesktopNotification(title string, message string, image string, playSound bool, _ int) error {
n := gosxnotifier.NewNotification(message)
n.Title = title
n.ContentImage = image
notification := gosxnotifier.NewNotification(message)
notification.Title = title
notification.ContentImage = image
if playSound {
n.Sound = gosxnotifier.Default
notification.Sound = gosxnotifier.Default
}
return n.Push()
return notification.Push()
}

View file

@ -15,11 +15,11 @@ func ConfigureBox(box *tview.Box, cfg *config.Theme) *tview.Box {
normalBorderStyle, activeBorderStyle := border.NormalStyle.Style, border.ActiveStyle.Style
normalBorderSet, activeBorderSet := border.NormalSet.BorderSet, border.ActiveSet.BorderSet
normalTitleStyle, activeTitleStyle := title.NormalStyle.Style, title.ActiveStyle.Style
p := border.Padding
padding := border.Padding
box.
SetBorderStyle(normalBorderStyle).
SetBorderSet(normalBorderSet).
SetBorderPadding(p[0], p[1], p[2], p[3]).
SetBorderPadding(padding[0], padding[1], padding[2], padding[3]).
SetTitleStyle(normalTitleStyle).
SetTitleAlignment(title.Alignment.Alignment).
SetBlurFunc(func() {