fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

Enabling numContextLines in non-json format (#796)

author
po3rin
committer
GitHub
date (Jul 29, 2024, 8:33 AM +0200) commit 04e7057f parent 12ce07a2
+6 -6
+1
web/api.go
··· 28 28 type LastInput struct { 29 29 Query string 30 30 Num int 31 + Ctx int 31 32 32 33 // If set, focus on the search box. 33 34 AutoFocus bool
+5 -6
web/server.go
··· 280 280 } 281 281 282 282 numCtxLines := 0 283 - if qvals.Get("format") == "json" { 284 - if ctxLinesStr := qvals.Get("ctx"); ctxLinesStr != "" { 285 - numCtxLines, err = strconv.Atoi(ctxLinesStr) 286 - if err != nil || numCtxLines < 0 || numCtxLines > 10 { 287 - return nil, fmt.Errorf("Number of context lines must be between 0 and 10") 288 - } 283 + if ctxLinesStr := qvals.Get("ctx"); ctxLinesStr != "" { 284 + numCtxLines, err = strconv.Atoi(ctxLinesStr) 285 + if err != nil || numCtxLines < 0 || numCtxLines > 10 { 286 + return nil, fmt.Errorf("Number of context lines must be between 0 and 10") 289 287 } 290 288 } 291 289 sOpts.NumContextLines = numCtxLines ··· 313 311 Last: LastInput{ 314 312 Query: queryStr, 315 313 Num: num, 314 + Ctx: numCtxLines, 316 315 AutoFocus: true, 317 316 }, 318 317 Stats: result.Stats,