chore: remove per-event debug logging from the normal path
Drop the log.Printf/fmt.Printf traces that fired on every config/input/ click/scroll/open/worker-result during IME and tap debugging. These were noise (and some were commented out). Error, limit, and recovery logs are kept; the default-off profiler and gated IME debug remain untouched.
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
package browser
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"pad/internal/ui"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// HandleScroll updates the browser scroll index by the given delta (in entries).
|
||||
@@ -103,13 +102,8 @@ func HandleBrowserTap(bm *BrowserManager, s *BrowserState, index int) {
|
||||
} else {
|
||||
// Open file
|
||||
s.SelectedIndex = entryIndex
|
||||
fmt.Printf("HandleBrowserTap: Opening file %s\n", entry.Path)
|
||||
if ui.OpenFile != nil {
|
||||
ui.OpenFile(entry.Path)
|
||||
}
|
||||
// Dispatch ReadFileTask to the worker pool
|
||||
// task := pool.NewReadFileTask(entry.Path, bm.fs)
|
||||
// fmt.Printf("HandleBrowserTap: Dispatching ReadFileTask for %s\n", entry.Path)
|
||||
// bm.workerPool.Dispatch(task)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,6 @@ func NewBrowserManager(state *BrowserState, wp *pool.WorkerPool, fs pool.FileSys
|
||||
}
|
||||
|
||||
func (bm *BrowserManager) NavigateTo(dirPath string) {
|
||||
fmt.Printf("NavigateTo: dirPath=%s, state.CurrentPath=%s\n", dirPath, bm.state.CurrentPath)
|
||||
|
||||
// Save the previous path so we can restore it on navigation failure.
|
||||
bm.state.History = append(bm.state.History, bm.state.CurrentPath)
|
||||
|
||||
@@ -55,11 +53,8 @@ func (bm *BrowserManager) OnScroll() {
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("OnScroll: minPage=%d, maxPage=%d, pagesToLoad=%v\n", minPage, maxPage, pagesToLoad)
|
||||
|
||||
// Dispatch LoadPagesTask for unloaded pages
|
||||
if len(pagesToLoad) > 0 {
|
||||
fmt.Printf("OnScroll: Dispatching LoadPagesTask for pages %v\n", pagesToLoad)
|
||||
task := pool.NewLoadPagesTask(bm.state.CurrentPath, pagesToLoad, bm.fs)
|
||||
bm.workerPool.Dispatch(task)
|
||||
}
|
||||
@@ -95,10 +90,10 @@ func (bm *BrowserManager) handleBuildIndexSuccess(result pool.Result) {
|
||||
// In the mock implementation, BuildIndexTask returns []types.DirEntry.
|
||||
// We need to convert these to browser.Entry and build the SortIndex.
|
||||
entries := result.Data.([]types.DirEntry)
|
||||
|
||||
|
||||
var browserEntries []Entry
|
||||
// Add ".." entry if not at root
|
||||
// We check against "/" specifically. "." is just a relative path for current dir,
|
||||
// We check against "/" specifically. "." is just a relative path for current dir,
|
||||
// which still has a parent.
|
||||
if bm.state.CurrentPath != "/" && bm.state.CurrentPath != "" {
|
||||
browserEntries = append(browserEntries, Entry{
|
||||
@@ -109,10 +104,9 @@ func (bm *BrowserManager) handleBuildIndexSuccess(result pool.Result) {
|
||||
IsDir: true,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
for _, e := range entries {
|
||||
info, _ := e.Info()
|
||||
fmt.Printf("Adding entry: %s\n", e.Name())
|
||||
browserEntries = append(browserEntries, Entry{
|
||||
Path: filepath.Join(bm.state.CurrentPath, e.Name()),
|
||||
Name: e.Name(),
|
||||
@@ -139,7 +133,6 @@ func (bm *BrowserManager) handleBuildIndexSuccess(result pool.Result) {
|
||||
}
|
||||
|
||||
bm.state.TotalEntries = len(browserEntries)
|
||||
fmt.Printf("handleBuildIndexSuccess: TotalEntries set to %d\n", bm.state.TotalEntries)
|
||||
|
||||
// Trigger initial page load
|
||||
bm.OnScroll()
|
||||
|
||||
@@ -163,7 +163,6 @@ func (l *Logic) Run() {
|
||||
defer l.exitWg.Done()
|
||||
|
||||
// Dispatch initial directory index build on startup
|
||||
log.Printf("Logic: Dispatching BuildIndexTask")
|
||||
l.workerPool.Dispatch(pool.NewBuildIndexTask(l.state.Browser.CurrentPath, l.mockFS))
|
||||
|
||||
for {
|
||||
@@ -171,14 +170,12 @@ func (l *Logic) Run() {
|
||||
case <-l.done:
|
||||
return
|
||||
case update := <-l.configChan:
|
||||
log.Printf("Logic: ConfigEvent")
|
||||
update.apply(l.state)
|
||||
l.emitFrame()
|
||||
case layout := <-l.layoutChan:
|
||||
// Store the full GlyphLayout on editor state.
|
||||
// Derive LastLineY from it for scroll clamping.
|
||||
l.state.Editor.GlyphLayout = layout
|
||||
log.Printf("LOGIC received GlyphLayout: ByteOffsets=%d, VisualLineStarts=%d", len(layout.ByteOffsets), len(layout.VisualLineStarts))
|
||||
var derivedLastLineY ui.Dp
|
||||
if len(layout.Y) > 0 {
|
||||
derivedLastLineY = layout.Y[len(layout.Y)-1]
|
||||
@@ -188,13 +185,11 @@ func (l *Logic) Run() {
|
||||
l.emitFrame()
|
||||
}
|
||||
case events := <-l.inputChan:
|
||||
log.Printf("Logic: InputEvents")
|
||||
for _, evt := range events {
|
||||
evt.Handler(evt.Data)
|
||||
}
|
||||
l.emitFrame()
|
||||
case query := <-l.searchQueryChan:
|
||||
log.Printf("Logic: SearchQuery")
|
||||
if query != l.state.Browser.Query {
|
||||
l.state.Browser.Query = query
|
||||
if l.state.page == BrowserPage {
|
||||
@@ -203,7 +198,6 @@ func (l *Logic) Run() {
|
||||
}
|
||||
l.emitFrame()
|
||||
case path := <-l.openFileChan:
|
||||
log.Printf("Logic: OpenFileChan %s", path)
|
||||
// Create chunked buffer for virtual scrolling
|
||||
chunkSize := DefaultChunkSize
|
||||
cb := NewChunkedBuffer(path, chunkSize, l.mockFS, "")
|
||||
@@ -235,7 +229,6 @@ func (l *Logic) Run() {
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
log.Printf("Logic: Dispatching WriteFileTask for %s, content len=%d", l.state.Editor.Filename, len(content))
|
||||
l.workerPool.DispatchNonBlocking(
|
||||
pool.NewWriteFileTask(l.state.Editor.Filename, content, l.mockFS),
|
||||
)
|
||||
@@ -418,7 +411,6 @@ func (l *Logic) handleWorkerResult(res pool.Result) {
|
||||
if res.IsBrowserResult() {
|
||||
l.browserManager.HandleResult(res)
|
||||
} else if res.TaskType == pool.TypeReadFile {
|
||||
log.Printf("Logic: TypeReadFile result success=%v", res.Success)
|
||||
if res.Success {
|
||||
if content, ok := res.Data.([]byte); ok {
|
||||
if l.state.Editor.ChunkedBuffer != nil {
|
||||
@@ -445,14 +437,12 @@ func (l *Logic) handleWorkerResult(res pool.Result) {
|
||||
cb.chunks = append(cb.chunks, nil)
|
||||
}
|
||||
cb.chunks[res.ChunkIdx] = chunk
|
||||
log.Printf("Logic: Loaded chunk %d for %s (%d bytes)", res.ChunkIdx, res.FilePath, len(chunk))
|
||||
}
|
||||
} else {
|
||||
log.Printf("Logic: ReadChunkTask failed for %s chunk %d: %v", res.FilePath, res.ChunkIdx, res.Error)
|
||||
}
|
||||
}
|
||||
} else if res.TaskType == pool.TypeStatFile {
|
||||
log.Printf("Logic: TypeStatFile result success=%v", res.Success)
|
||||
if res.Success {
|
||||
if stat, ok := res.Data.(*pool.FileStat); ok {
|
||||
// Size guard: refuse to edit files above the limit. The browser can
|
||||
@@ -473,12 +463,10 @@ func (l *Logic) handleWorkerResult(res pool.Result) {
|
||||
}
|
||||
}
|
||||
} else if res.TaskType == pool.TypeBuildLineIndex {
|
||||
log.Printf("Logic: TypeBuildLineIndex result success=%v", res.Success)
|
||||
if res.Success {
|
||||
if idx, ok := res.Data.(*types.LineIndex); ok {
|
||||
if l.state.Editor.ChunkedBuffer != nil {
|
||||
l.state.Editor.ChunkedBuffer.LineIndex = idx
|
||||
log.Printf("Logic: LineIndex built with %d lines", idx.LineCount())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"image"
|
||||
"image/color"
|
||||
_ "image/png"
|
||||
"log"
|
||||
"sort"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
@@ -222,11 +221,10 @@ func (r *Renderer) RegisterScroll(gtx layout.Context, id string, region Region,
|
||||
// CheckGestures checks all registered gestures and returns any events.
|
||||
func (r *Renderer) CheckGestures(q input.Source, m unit.Metric) []InputEvent {
|
||||
var events []InputEvent
|
||||
for id, reg := range r.clicks {
|
||||
for _, reg := range r.clicks {
|
||||
evt, ok := reg.click.Update(q)
|
||||
if ok {
|
||||
if evt.Kind == gesture.KindClick {
|
||||
log.Printf("Renderer: Click detected on %s, pos=%v", id, evt.Position)
|
||||
events = append(events, InputEvent{
|
||||
Handler: reg.handler,
|
||||
Data: Point{X: r.toDp(Px(evt.Position.X)), Y: r.toDp(Px(evt.Position.Y))},
|
||||
@@ -266,7 +264,6 @@ func (r *Renderer) LastLineY() Dp {
|
||||
// drawWrappedText call. Used by the logic goroutine to position the cursor
|
||||
// and navigate by glyph instead of byte offset.
|
||||
func (r *Renderer) GlyphLayout() GlyphLayout {
|
||||
log.Printf("VisualLineStarts = %v", r.glyphLayout.VisualLineStarts)
|
||||
return r.glyphLayout
|
||||
}
|
||||
|
||||
@@ -304,7 +301,6 @@ func (r *Renderer) drawElement(gtx layout.Context, e Element) {
|
||||
if interactive, ok := e.(Interactive); ok {
|
||||
for _, interaction := range interactive.Interactions() {
|
||||
if interaction.Gesture == KeyDown || interaction.Gesture == KeyUp {
|
||||
log.Printf("register gesture for %s", interactive.ID())
|
||||
event.Op(gtx.Ops, interactive.ID())
|
||||
reg := keyReg{Handler: interaction.Handler}
|
||||
r.Keys[interactive.ID()] = reg
|
||||
@@ -341,7 +337,6 @@ func (r *Renderer) drawElement(gtx layout.Context, e Element) {
|
||||
// Register input tag for key events
|
||||
for _, interaction := range interactive.Interactions() {
|
||||
if interaction.Gesture == KeyDown || interaction.Gesture == KeyUp {
|
||||
log.Printf("register gesture for %s", interactive.ID())
|
||||
event.Op(gtx.Ops, interactive.ID())
|
||||
|
||||
// Register handler
|
||||
|
||||
Reference in New Issue
Block a user