Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support home and end keys #58

Merged
merged 3 commits into from
May 5, 2024
Merged

support home and end keys #58

merged 3 commits into from
May 5, 2024

Conversation

slingamn
Copy link
Member

No description provided.

@slingamn
Copy link
Member Author

Not sure whether the technique here actually works! The escape analyzer thinks it does:

./terminal.go:384:23: payload does not escape
./terminal.go:386:45: string(payload[:semicolonIdx]) does not escape
./terminal.go:387:46: string(payload[semicolonIdx + 1:]) does not escape

but the disassembler seems to disagree:

  terminal.go:384       0x4b9340                493b6610                CMPQ SP, 0x10(R14)                                      
  terminal.go:384       0x4b9344                0f862a010000            JBE 0x4b9474                                            
  terminal.go:384       0x4b934a                55                      PUSHQ BP                                                
  terminal.go:384       0x4b934b                4889e5                  MOVQ SP, BP                                             
  terminal.go:384       0x4b934e                4883ec78                SUBQ $0x78, SP                                          
  terminal.go:385       0x4b9352                48898c2498000000        MOVQ CX, 0x98(SP)                                       
  terminal.go:385       0x4b935a                4889842488000000        MOVQ AX, 0x88(SP)                                       
  terminal.go:385       0x4b9362                48899c2490000000        MOVQ BX, 0x90(SP)                                       
  bytes.go:96           0x4b936a                48890424                MOVQ AX, 0(SP)                                          
  bytes.go:96           0x4b936e                48895c2408              MOVQ BX, 0x8(SP)                                        
  bytes.go:96           0x4b9373                48894c2410              MOVQ CX, 0x10(SP)                                       
  bytes.go:96           0x4b9378                c64424183b              MOVB $0x3b, 0x18(SP)                                    
  bytes.go:96           0x4b937d                0f1f00                  NOPL 0(AX)                                              
  bytes.go:96           0x4b9380                e8bb9ef4ff              CALL internal/bytealg.IndexByte.abi0(SB)                
  bytes.go:96           0x4b9385                450f57ff                XORPS X15, X15                                          
  bytes.go:96           0x4b9389                644c8b3425f8ffffff      MOVQ FS:0xfffffff8, R14                                 
  bytes.go:96           0x4b9392                488b4c2420              MOVQ 0x20(SP), CX                                       
  bytes.go:96           0x4b9397                660f1f840000000000      NOPW 0(AX)(AX*1)                                        
  terminal.go:385       0x4b93a0                4883f9ff                CMPQ CX, $-0x1                                          
  terminal.go:385       0x4b93a4                0f849e000000            JE 0x4b9448                                             
  terminal.go:386       0x4b93aa                488b942498000000        MOVQ 0x98(SP), DX                                       
  terminal.go:386       0x4b93b2                4839ca                  CMPQ DX, CX                                             
  terminal.go:386       0x4b93b5                0f82b3000000            JB 0x4b946e                                             
  bytes.go:96           0x4b93bb                48894c2468              MOVQ CX, 0x68(SP)                                       
  terminal.go:386       0x4b93c0                488d442448              LEAQ 0x48(SP), AX                                       
  terminal.go:386       0x4b93c5                488b9c2488000000        MOVQ 0x88(SP), BX                                       
  terminal.go:386       0x4b93cd                e8ae9bf9ff              CALL runtime.slicebytetostring(SB)                      
  terminal.go:386       0x4b93d2                e82985fbff              CALL strconv.Atoi(SB)                                   

since runtime.slicebytetostring seems to allocate, but, not sure.

@slingamn slingamn merged commit e90ce13 into master May 5, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant