Skip to content

Commit

Permalink
Paint the cursor position border if multiple lines are selected
Browse files Browse the repository at this point in the history
When multi cursors and zero width column selection is involved, there are some edge cases where the border does not include the last selected line in the document. But I guess this implementation should be good enough.
  • Loading branch information
Kai Wood committed Jan 17, 2014
1 parent 74567b1 commit aedda8c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
14 changes: 13 additions & 1 deletion Support/app/views/annotate/_content.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@
# puts annotations.inspect
last_formatted_line = {}

range_min, range_max = selected_line_range

formatted_annotations = annotations.map do |annotation|
line_class = []
line_class << "selected" if ENV["TM_LINE_NUMBER"].to_i == annotation[:ln].to_i

if (range_min == range_max) && range_min == annotation[:ln].to_i
line_class << "selected"
elsif range_min == annotation[:ln].to_i
line_class << "ranged-top"
elsif range_max == annotation[:ln].to_i
line_class << "ranged-bottom"
elsif annotation[:ln].to_i.between?(range_min, range_max)
line_class << "ranged-middle"
end

line_class << "ins" if annotation[:rev] == "-current-" || annotation[:rev] == revision
line_class = line_class * " "
formatted_line = {
Expand Down
18 changes: 16 additions & 2 deletions Support/resource/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,22 @@ table.codediff td.hidden del { display:none; }
table.codediff td.del { background: #fdd; }
table.codediff td.ins { background: #dfd; }
table.codediff td.selected {
border: 5px solid #aaf !important;
}
border: 5px solid #aaf !important;
}
table.codediff td.ranged-top {
border-top: 5px solid #aaf !important;
border-right: 5px solid #aaf !important;
border-left: 5px solid #aaf !important;
}
table.codediff td.ranged-middle {
border-right: 5px solid #aaf !important;
border-left: 5px solid #aaf !important;
}
table.codediff td.ranged-bottom {
border-right: 5px solid #aaf !important;
border-bottom: 5px solid #aaf !important;
border-left: 5px solid #aaf !important;
}
table.sidebyside tbody.mod td { background: #fe9; }
table.sidebyside tbody.mod td { background: #fe9; }
table.sidebyside tbody.mod td ins, table.sidebyside tbody.mod td del{ background: #fd4; }
Expand Down

0 comments on commit aedda8c

Please sign in to comment.