Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
vimagit
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
jreybert
vimagit
Commits
5ca538ed
Commit
5ca538ed
authored
9 years ago
by
Jerome Reybert
Committed by
Jerome Reybert
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
autoload/state.vim: file object handles itself its display
parent
f27f5456
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
autoload/magit/state.vim
+26
-0
26 additions, 0 deletions
autoload/magit/state.vim
plugin/magit.vim
+3
-25
3 additions, 25 deletions
plugin/magit.vim
with
29 additions
and
25 deletions
autoload/magit/state.vim
+
26
−
0
View file @
5ca538ed
...
...
@@ -96,6 +96,31 @@ function! magit#state#file_set_diff(val) dict
endif
endfunction
function
!
magit#
state
#file_put
()
dict
"if ( self.dirty != 0 )
if
(
1
)
let
bufnr
=
magit#utils#
bufnr
()
let
self
.
sign_start
=
magit#
sign
#add_sign
(
line
(
'.'
),
'S'
,
bufnr
)
put
=
file
.
get_filename_header
()
if
(
self
.
dir
!=
0
)
if
(
self
.
visible
==
1
)
let
self
.
sign_end
=
magit#
sign
#add_sign
(
line
(
'.'
),
'E'
,
bufnr
)
return
1
endif
endif
if
(
self
.
visible
==
0
)
let
self
.
sign_end
=
magit#
sign
#add_sign
(
line
(
'.'
),
'E'
,
bufnr
)
return
0
endif
if
(
self
.
exists
==
0
)
echoerr
"Error, "
.
self
.
filename
.
" should not exists"
endif
let
hunk_lines
=
self
.
get_flat_hunks
()
silent
put
=
hunk_lines
let
self
.
sign_end
=
magit#
sign
#add_sign
(
line
(
'.'
),
'E'
,
bufnr
)
endif
endfunction
" s:hunk_template: template for hunk object (nested in s:diff_template)
" WARNING: this variable must be deepcopy()'ied
let
s:hunk_template
=
{
...
...
@@ -144,6 +169,7 @@ let s:file_template = {
\
'get_flat_hunks'
:
function
(
"magit#state#file_get_flat_hunks"
),
\
'toggle_visible'
:
function
(
"magit#state#toggle_file_visible"
),
\
'must_be_added'
:
function
(
"magit#state#must_be_added"
),
\
'put'
:
function
(
"magit#state#file_put"
),
\
}
" magit#state#get_file: function accessor for file
...
...
This diff is collapsed.
Click to expand it.
plugin/magit.vim
+
3
−
25
View file @
5ca538ed
...
...
@@ -141,35 +141,13 @@ function! s:mg_display_files(mode, curdir, depth)
" FIXME: ouch, must store subdirs in more efficient way
for
filename
in
sort
(
keys
(
s:state
.
get_files
(
a:mode
)))
let
file
=
s:state
.
get_file
(
a:mode
,
filename
,
0
)
let
file
=
s:state
.
get_file
(
a:mode
,
filename
)
if
(
file
.
depth
!=
a:depth
||
filename
!~
a:curdir
.
'.*'
)
continue
endif
put
=
file
.
get_filename_header
()
if
(
file
.
dir
!=
0
)
if
(
file
.
visible
==
1
)
if
(
file
.
put
()
!=
0
)
call
s:mg_display_files
(
a:mode
,
filename
,
a:depth
+
1
)
continue
endif
endif
if
(
file
.
visible
==
0
)
put
=
''
continue
endif
if
(
file
.
exists
==
0
)
echoerr
"Error, "
.
filename
.
" should not exists"
endif
let
hunks
=
file
.
get_hunks
()
for
hunk
in
hunks
if
(
hunk
.
header
!=
''
)
silent
put
=
hunk
.
header
endif
if
(
!
empty
(
hunk
.
lines
)
)
silent
put
=
hunk
.
lines
endif
endfor
put
=
''
endfor
endfunction
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment