@@ -9,7 +9,6 @@ import { use_ghost_text } from './hooks/use-ghost-text'
99import { use_drag_drop } from './hooks/use-drag-drop'
1010import { DropdownMenu } from '../../common/DropdownMenu'
1111import { use_is_narrow_viewport , use_is_mac } from '@shared/hooks'
12- import { get_display_text } from './utils/get-display-text'
1312import {
1413 get_caret_position_from_div ,
1514 set_caret_position_for_div
@@ -42,7 +41,7 @@ const Tooltip: React.FC<{
4241 </ div >
4342)
4443
45- export type EditFormat = 'whole' | 'truncated' | 'diff'
44+ export type EditFormat = 'whole' | 'truncated' | 'diff' | 'compared'
4645
4746export type PromptFieldProps = {
4847 value : string
@@ -105,6 +104,9 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
105104 case 'KeyT' :
106105 format = 'truncated'
107106 break
107+ case 'KeyC' :
108+ format = 'compared'
109+ break
108110 case 'KeyD' :
109111 format = 'diff'
110112 break
@@ -309,6 +311,7 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
309311 return {
310312 whole : `(${ modifier } W)` ,
311313 truncated : `(${ modifier } T)` ,
314+ compared : `(${ modifier } C)` ,
312315 diff : `(${ modifier } D)`
313316 }
314317 } , [ is_mac ] )
@@ -466,55 +469,57 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
466469 >
467470 { props . show_edit_format_selector && (
468471 < div className = { styles [ 'footer__right__edit-format' ] } >
469- { ( [ 'whole' , 'truncated' , 'diff' ] as const ) . map ( ( format ) => {
470- const button_text = is_narrow_viewport
471- ? format . charAt ( 0 ) . toUpperCase ( )
472- : format
473- const is_selected = props . edit_format == format
474- const should_underline = is_alt_pressed && ! is_selected
472+ { ( [ 'whole' , 'truncated' , 'compared' , 'diff' ] as const ) . map (
473+ ( format ) => {
474+ const button_text = is_narrow_viewport
475+ ? format . charAt ( 0 ) . toUpperCase ( )
476+ : format
477+ const is_selected = props . edit_format == format
478+ const should_underline = is_alt_pressed && ! is_selected
475479
476- return (
477- < button
478- key = { format }
479- className = { cn (
480- styles [ 'footer__right__edit-format__button' ] ,
481- {
482- [ styles [
483- 'footer__right__edit-format__button--selected'
484- ] ] : is_selected
485- }
486- ) }
487- title = { `Edit format instructions to include with the prompt ${ edit_format_shortcuts [ format ] } \n\n${
488- props . edit_format_instructions ?. [ format ]
489- } `}
490- onClick = { ( ) => props . on_edit_format_change ?.( format ) }
491- >
492- < span
493- className = {
494- styles [ 'footer__right__edit-format__button__spacer' ]
495- }
496- >
497- { button_text }
498- </ span >
499- < span
500- className = {
501- styles [ 'footer__right__edit-format__button__text' ]
502- }
503- >
504- { should_underline ? (
505- < >
506- < span className = { styles [ 'underlined' ] } >
507- { button_text . charAt ( 0 ) }
508- </ span >
509- { button_text . substring ( 1 ) }
510- </ >
511- ) : (
512- button_text
480+ return (
481+ < button
482+ key = { format }
483+ className = { cn (
484+ styles [ 'footer__right__edit-format__button' ] ,
485+ {
486+ [ styles [
487+ 'footer__right__edit-format__button--selected'
488+ ] ] : is_selected
489+ }
513490 ) }
514- </ span >
515- </ button >
516- )
517- } ) }
491+ title = { `Edit format instructions to include with the prompt ${ edit_format_shortcuts [ format ] } \n\n${
492+ props . edit_format_instructions ?. [ format ]
493+ } `}
494+ onClick = { ( ) => props . on_edit_format_change ?.( format ) }
495+ >
496+ < span
497+ className = {
498+ styles [ 'footer__right__edit-format__button__spacer' ]
499+ }
500+ >
501+ { button_text }
502+ </ span >
503+ < span
504+ className = {
505+ styles [ 'footer__right__edit-format__button__text' ]
506+ }
507+ >
508+ { should_underline ? (
509+ < >
510+ < span className = { styles [ 'underlined' ] } >
511+ { button_text . charAt ( 0 ) }
512+ </ span >
513+ { button_text . substring ( 1 ) }
514+ </ >
515+ ) : (
516+ button_text
517+ ) }
518+ </ span >
519+ </ button >
520+ )
521+ }
522+ ) }
518523 </ div >
519524 ) }
520525
0 commit comments