80- (or n-) column indicator in diff viewer
Review Request #11294 — Created Nov. 20, 2020 and updated
The current diff viewer does not have a column indicator that shows
the character boundary. Adding the feature will allow reviewers to see
when a line exceeds n characters.We added a red dashed line on the diff viewer at the specified column.
The indicator defaults to 80 characters and the user can specify a
number at the input box on top. With file changes, the indicator shows
on both side of the diff viewer and changes together. We also check
for the maximum column number based on the diff viewer's size. If the
diff viewer is shrunk beyond the indicator, the indicator will be
hidden.We added the indicator as a
div
which the CSS property
border-left: 1px dashed red
. Whenever the column number is changed,
moveColumnIndicator()
does the calculation and moves the indicator
to the new position with jQuery'scss()
. Although JS function does
the calculations everytime the position changes, in theory, a user
will not be changing the position too often.Testing Done:
Tested following behaviours:
- Set column indicator to 0 (check underflow)
- Set column indicator to 999 (check overflow)
- Check indicator line
Browsers tested:
- Chrome (Version 87.0.4280)
- Edge (Version 87.0.664.5)
- Firefox (Version 83.0)
- Safari (Version 14.0.1)
Tested following behaviours:
- Set column indicator to 0 (check underflow)
- Set column indicator to 999 (check overflow)
- Check indicator line
Browsers tested:
- Chrome (Version 87.0.4280)
- Edge (Version 87.0.664.5)
- Firefox (Version 83.0)
- Safari (Version 14.0.1)
Summary | ID |
---|---|
3613bb055efa6752a312c1d9805b52397c8eee1c |
Description | From | Last Updated |
---|---|---|
I tried hosting the patched server on my local machine and the column indicator looks great! I agree with Jacob … |
bnie | |
It looks like some lines in the description are longer than the format expected. Could you target ~70 (upwards of … |
ceciliawei | |
When referencing a JavaScript method in the docs, you'll want to use the js:meth: role, like: :js:meth:`_moveColumnIndicator` Same with docs … |
chipx86 | |
Rather than var, this should use const. Or just pass the expression into the call that needs it. I would … |
chipx86 | |
You can define these where they're needed. Either const or let should be used instead of var, depending on whether … |
chipx86 | |
Let's use .text(), to better communicate that we're not inserting HTML. |
chipx86 | |
Where does this number come from? |
chipx86 | |
Blank line between statements that form blocks. |
chipx86 | |
The - operator should go on the previous line, and each line of the expression should be aligned. |
chipx86 | |
Each parameter to Math.min() should be aligned. |
chipx86 | |
You can use template literals here and above: `translateX(${columnNum * charWidth}px)` |
chipx86 |
- Commits:
-
Summary ID be92b0295198c3ae0bb2f033796838f3d392aee6 be92b0295198c3ae0bb2f033796838f3d392aee6 10987cf14be5c3a16b8d29d01faea67825a1c5ec
Checks run (2 succeeded)
- Change Summary:
-
Add Description.
- Description:
-
~ Add indicator line.
~ The current diff viewer does not have a column indicator that shows the
+ character boundary. Adding the feature will allow reviewers to see when a line + exceeds n characters. + + We added a red dashed line on the diff viewer at the specified column. The
+ indicator defaults to 80 characters and the user can specify a number at the + input box on top. With file changes, the indicator shows on both side of the + diff viewer and changes together. We also check for the maximum column number + based on the diff viewer's size. If the diff viewer is shrunk beyond the + indicator, the indicator will be hidden. + + We added the indicator as a
div
which the CSS property+ border-left: 1px dashed red
. Whenever the column number is changed,+ moveColumnIndicator()
does the calculation and moves the indicator to the new+ position with jQuery's css()
. Although JS function does the calculations+ everytime the position changes, in theory, a user will not be changing the + position too often. - Commits:
-
Summary ID be92b0295198c3ae0bb2f033796838f3d392aee6 10987cf14be5c3a16b8d29d01faea67825a1c5ec a08332bb78a1dd1dbe06710103ac70d1caa071d5 a8b47243d3cdb7c7669a2ccef7da7fa30451cc19 f570cddeca3982a058bbe12458a3d2d394fac696 61113b7f86f900914de399bb031a659a24e66109 - Groups:
-
- Diff:
Revision 3 (+251 -33)
- Added Files:
Checks run (2 succeeded)
flake8 passed.JSHint passed.
- Change Summary:
-
Clean up commits.
- Testing Done:
-
+ Tested following behaviours:
+ + - Set column indicator to 0 (check underflow)
+ - Set column indicator to 999 (check overflow)
+ - Check indicator line
+ + Browsers tested:
+ + - Chrome (Version 87.0.4280)
+ - Edge (Version 87.0.664.5)
+ - Firefox (Version 83.0)
+ - Safari (Version 14.0.1)
- Commits:
-
Summary ID a08332bb78a1dd1dbe06710103ac70d1caa071d5 a8b47243d3cdb7c7669a2ccef7da7fa30451cc19 f570cddeca3982a058bbe12458a3d2d394fac696 61113b7f86f900914de399bb031a659a24e66109 81e0478b25cc8fcd5245c081ea39711939665804
Checks run (2 succeeded)
-
-
When referencing a JavaScript method in the docs, you'll want to use the
js:meth:
role, like::js:meth:`_moveColumnIndicator`
Same with docs below.
-
Rather than
var
, this should useconst
. Or just pass the expression into the call that needs it.I would rework this to properly use the chaining syntax:
cons newColumnNum = this.$el .find('....') .val()
That's often used with jQuery, and it helps make each step in the chain clear.
-
You can define these where they're needed. Either
const
orlet
should be used instead ofvar
, depending on whether the variable needs to be reassigned. -
-
-
-
-
-
- Change Summary:
-
Address feedback (fix styling).
- Commits:
-
Summary ID 81e0478b25cc8fcd5245c081ea39711939665804 5c41bef8b144b36b22e2ad6d6d2b32df3f8934ce
Checks run (2 succeeded)
-
I pulled down the patch, ran it locally, and it works great. Awesome work Kean! Not sure that I am too familiar with the code, so I will comment mostly on my user experience. Firstly, I noticed that the column indicator input text can overlap with the New File Download button if set to 0, this could be annoying especially for users that are uninterested in seeing the column indicator. In addition, I think that it could be useful to have a toggle button on the indicator to turn it on/off and give users more flexibility. I also noticed that the input field works with hexadecimal numbers such as
0xf
, not sure if that is the intended behavior. But it's kind of cool nonetheless.
-
-
I tried hosting the patched server on my local machine and the column indicator looks great!
I agree with Jacob on the part when user sets the column indicator to around 5, the indicator overlaps with the text below it.
Also, I tested the diff viewer on both Chrome Version 86 and Safari 14. The indicator works perfectly on Chrome but on Safari, the indicator text box does not align with the indicator line, I've attached a picture below. This only happends when you first load the page and if you set it to something else and set it back later, the text box does align with the line indicator.
- Change Summary:
-
Change input box to fixed position and update screenshot. (details)
- Commits:
-
Summary ID 5c41bef8b144b36b22e2ad6d6d2b32df3f8934ce 3613bb055efa6752a312c1d9805b52397c8eee1c - Diff:
-
Revision 6 (+194 -4)
- Added Files:
Checks run (2 succeeded)
- Change Summary:
-
Update description to wrap at 70 columns.
- Description:
-
~ The current diff viewer does not have a column indicator that shows the
~ character boundary. Adding the feature will allow reviewers to see when a line ~ exceeds n characters. ~ The current diff viewer does not have a column indicator that shows
~ the character boundary. Adding the feature will allow reviewers to see ~ when a line exceeds n characters. ~ We added a red dashed line on the diff viewer at the specified column. The
~ indicator defaults to 80 characters and the user can specify a number at the ~ input box on top. With file changes, the indicator shows on both side of the ~ diff viewer and changes together. We also check for the maximum column number ~ based on the diff viewer's size. If the diff viewer is shrunk beyond the ~ indicator, the indicator will be hidden. ~ We added a red dashed line on the diff viewer at the specified column.
~ The indicator defaults to 80 characters and the user can specify a ~ number at the input box on top. With file changes, the indicator shows ~ on both side of the diff viewer and changes together. We also check ~ for the maximum column number based on the diff viewer's size. If the ~ diff viewer is shrunk beyond the indicator, the indicator will be + hidden. We added the indicator as a
div
which the CSS propertyborder-left: 1px dashed red
. Whenever the column number is changed,~ moveColumnIndicator()
does the calculation and moves the indicator to the new~ position with jQuery's css()
. Although JS function does the calculations~ everytime the position changes, in theory, a user will not be changing the ~ position too often. ~ moveColumnIndicator()
does the calculation and moves the indicator~ to the new position with jQuery's css()
. Although JS function does~ the calculations everytime the position changes, in theory, a user ~ will not be changing the position too often. + + Testing Done:
+ + Tested following behaviours:
+ * Set column indicator to 0 (check underflow) + * Set column indicator to 999 (check overflow) + * Check indicator line + + Browsers tested:
+ * Chrome (Version 87.0.4280) + * Edge (Version 87.0.664.5) + * Firefox (Version 83.0) + * Safari (Version 14.0.1)
- Change Summary:
-
Update description.
- Description:
-
The current diff viewer does not have a column indicator that shows
the character boundary. Adding the feature will allow reviewers to see when a line exceeds n characters. We added a red dashed line on the diff viewer at the specified column.
The indicator defaults to 80 characters and the user can specify a number at the input box on top. With file changes, the indicator shows on both side of the diff viewer and changes together. We also check for the maximum column number based on the diff viewer's size. If the diff viewer is shrunk beyond the indicator, the indicator will be hidden. We added the indicator as a
div
which the CSS propertyborder-left: 1px dashed red
. Whenever the column number is changed,moveColumnIndicator()
does the calculation and moves the indicatorto the new position with jQuery's css()
. Although JS function doesthe calculations everytime the position changes, in theory, a user will not be changing the position too often. Testing Done:
~ Tested following behaviours:
~ Tested following behaviours:
- * Set column indicator to 0 (check underflow) - * Set column indicator to 999 (check overflow) - * Check indicator line ~ Browsers tested:
~ * Chrome (Version 87.0.4280) ~ * Edge (Version 87.0.664.5) ~ * Firefox (Version 83.0) ~ * Safari (Version 14.0.1) ~ - Set column indicator to 0 (check underflow)
~ - Set column indicator to 999 (check overflow)
~ - Check indicator line
~ ~ Browsers tested:
+ + - Chrome (Version 87.0.4280)
+ - Edge (Version 87.0.664.5)
+ - Firefox (Version 83.0)
+ - Safari (Version 14.0.1)