@bojackduy/opencode-telescope 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,6 +49,7 @@ export const ResultRow = (props: {
49
49
  query={props.query}
50
50
  active={props.active}
51
51
  theme={props.theme}
52
+ maxWidth={props.width}
52
53
  />
53
54
  </box>
54
55
  )
@@ -88,14 +89,23 @@ const HighlightedText = (props: {
88
89
  query: string
89
90
  active: boolean
90
91
  theme: TuiThemeCurrent
91
- }) => (
92
- <text wrapMode="none" overflow="hidden">
93
- <span style={{ fg: props.theme.textMuted }}> </span>
94
- <span style={{ fg: props.active ? props.theme.text : props.theme.textMuted }}>{props.before}</span>
95
- <span style={{ fg: props.theme.warning, bold: true }}>{props.match || props.query}</span>
96
- <span style={{ fg: props.active ? props.theme.text : props.theme.textMuted }}>{props.after}</span>
97
- </text>
98
- )
92
+ maxWidth: number
93
+ }) => {
94
+ const textMax = Math.max(10, props.maxWidth - 2)
95
+ const sideMax = Math.floor(textMax * 0.35)
96
+ const matchMax = textMax - sideMax * 2
97
+ const before = truncate(props.before, sideMax)
98
+ const match = truncate(props.match || props.query, matchMax)
99
+ const after = truncate(props.after, sideMax)
100
+ return (
101
+ <text wrapMode="none" overflow="hidden">
102
+ <span style={{ fg: props.theme.textMuted }}> </span>
103
+ <span style={{ fg: props.active ? props.theme.text : props.theme.textMuted }}>{before}</span>
104
+ <span style={{ fg: props.theme.warning, bold: true }}>{match}</span>
105
+ <span style={{ fg: props.active ? props.theme.text : props.theme.textMuted }}>{after}</span>
106
+ </text>
107
+ )
108
+ }
99
109
 
100
110
  function sessionTitleWidth(width: number) {
101
111
  if (width >= 54) return 28
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@bojackduy/opencode-telescope",
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
5
5
  "description": "Fuzzy search across all OpenCode conversations — grep session and chat history, find code snippets, and jump to any chat instantly",
6
6
  "type": "module",
7
7
  "license": "MIT",
package/telescope.tsx CHANGED
@@ -306,7 +306,7 @@ export const Telescope = (props: { api: TuiPluginApi; onClose: () => void }) =>
306
306
  }}
307
307
  flexGrow={1}
308
308
  />
309
- <text fg={theme().textMuted}>{busy() ? "searching" : loading() ? "loading..." : query().trim() ? `${results().length} hits` : `${results().length} recent`}</text>
309
+ <text fg={theme().textMuted}>{busy() ? "searching" : loading() ? "loading..." : query().trim() ? (results().length > 0 ? `${selected() + 1}/${results().length} hits` : "0 hits") : (results().length > 0 ? `${selected() + 1}/${results().length} recent` : "0 recent")}</text>
310
310
  </box>
311
311
  </box>
312
312