summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorRyooooooga <ryoga_314@yahoo.co.jp>2021-03-02 12:51:36 +0900
committerJesse Duffield <jessedduffield@gmail.com>2021-03-13 11:02:31 +1100
commita48cc245e711f144254b2bb13efe901cdfbd9059 (patch)
treee57e8ac6d1efb70dff50a40929a83562397cbeb0 /pkg/commands
parent9ed3a8ee0561f92ae75c739f0bad749e782bafa2 (diff)
Support multibyte characters in pane
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/loading_commit_files.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/pkg/commands/loading_commit_files.go b/pkg/commands/loading_commit_files.go
index 8a633156c..ad209fdd3 100644
--- a/pkg/commands/loading_commit_files.go
+++ b/pkg/commands/loading_commit_files.go
@@ -14,7 +14,7 @@ func (c *GitCommand) GetFilesInDiff(from string, to string, reverse bool, patchM
reverseFlag = " -R "
}
- filenames, err := c.OSCommand.RunCommandWithOutput("git diff --submodule --no-ext-diff --name-status %s %s %s", reverseFlag, from, to)
+ filenames, err := c.OSCommand.RunCommandWithOutput("git diff --submodule --no-ext-diff --name-status -z %s %s %s", reverseFlag, from, to)
if err != nil {
return nil, err
}
@@ -26,13 +26,12 @@ func (c *GitCommand) GetFilesInDiff(from string, to string, reverse bool, patchM
func (c *GitCommand) getCommitFilesFromFilenames(filenames string, parent string, patchManager *patch.PatchManager) []*models.CommitFile {
commitFiles := make([]*models.CommitFile, 0)
- for _, line := range strings.Split(strings.TrimRight(filenames, "\n"), "\n") {
+ lines := strings.Split(strings.TrimRight(filenames, "\x00"), "\x00")
+ n := len(lines)
+ for i := 0; i < n-1; i += 2 {
// typical result looks like 'A my_file' meaning my_file was added
- if line == "" {
- continue
- }
- changeStatus := line[0:1]
- name := line[2:]
+ changeStatus := lines[i+0]
+ name := lines[i+1]
status := patch.UNSELECTED
if patchManager != nil && patchManager.To == parent {
status = patchManager.GetFileStatus(name)