detached 173610c

feat(webkit): add WebView ID string conversion helpers

Add convenience methods for converting between uint64 and string WebView IDs:
- WebView.IDString() - converts ID to string for compatibility with string-based APIs
- ParseWebViewID(string) - parses string ID back to uint64

These helpers will make the gotk4 migration cleaner by providing a standard
way to handle ID conversions throughout the codebase, particularly for:
- Message passing where IDs are transmitted as strings
- Popup management where parent/child relationships use string IDs
- Legacy code expecting string IDs

Usage examples:
  webView.IDString()           // "123" instead of fmt.Sprintf("%d", webView.ID())
  ParseWebViewID(msg.WebViewID) // 123 instead of manual parsing
commit
173610c5e97a94850aec4e826dfe0e1ea2e515e6
author
bamen · · 2025-10-08 20:26 UTC
committer
bamen · · 2025-10-08 18:17 UTC
parent
4643f94
signature
unsigned
1 file · +17 -0
M pkg/webkit/webview.go +17 -0
@@ -2,6 +2,7 @@ package webkit
22
33 import (
44 "fmt"
5+ "strconv"
56 "sync"
67 "sync/atomic"
78
@@ -294,6 +295,22 @@ func (w *WebView) ID() uint64 {
294295 return w.id
295296 }
296297
298+// IDString returns the WebView ID as a string
299+// This is a convenience method for compatibility with code expecting string IDs
300+func (w *WebView) IDString() string {
301+ return fmt.Sprintf("%d", w.id)
302+}
303+
304+// ParseWebViewID converts a string WebView ID to uint64
305+// Returns 0 if the string cannot be parsed
306+func ParseWebViewID(idStr string) uint64 {
307+ id, err := strconv.ParseUint(idStr, 10, 64)
308+ if err != nil {
309+ return 0
310+ }
311+ return id
312+}
313+
297314 // AsWidget returns the WebView as a gtk.Widgetter
298315 func (w *WebView) AsWidget() gtk.Widgetter {
299316 if w == nil || w.view == nil {
@@ -2,6 +2,7 @@ package webkit
2 2
3 import (3 import (
4 "fmt"4 "fmt"
5+ "strconv"
5 "sync"6 "sync"
6 "sync/atomic"7 "sync/atomic"
7 8
@@ -294,6 +295,22 @@ func (w *WebView) ID() uint64 {
294 return w.id295 return w.id
295 }296 }
296 297
298+// IDString returns the WebView ID as a string
299+// This is a convenience method for compatibility with code expecting string IDs
300+func (w *WebView) IDString() string {
301+ return fmt.Sprintf("%d", w.id)
302+}
303+
304+// ParseWebViewID converts a string WebView ID to uint64
305+// Returns 0 if the string cannot be parsed
306+func ParseWebViewID(idStr string) uint64 {
307+ id, err := strconv.ParseUint(idStr, 10, 64)
308+ if err != nil {
309+ return 0
310+ }
311+ return id
312+}
313+
297 // AsWidget returns the WebView as a gtk.Widgetter314 // AsWidget returns the WebView as a gtk.Widgetter
298 func (w *WebView) AsWidget() gtk.Widgetter {315 func (w *WebView) AsWidget() gtk.Widgetter {
299 if w == nil || w.view == nil {316 if w == nil || w.view == nil {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close