Project

General

Profile

Actions

Feature #3382

closed

Ability to select only source code without line numbers

Added by Gregor Bader almost 15 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Text formatting
Target version:
-
Start date:
2009-05-18
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate

Description

Currently if you use

<pre><code class="ruby">
  Place you code here.
</code>

to insert code into somewhere you are not able to copy/paste only the code! The line numbers are selected, too!
Perhaps update of coderay could solve this?
require 'rubygems'
require 'coderay'
tokens = CodeRay.scan <<-'CODE', :ruby
  puts %[Hello, world!]
  puts "Here\'s some #@@weird #{ { :code => "for you" } }" 
CODE
print tokens.div(:line_numbers => :table, :css => :class)


Files

code_table_line_numbers.png (79.6 KB) code_table_line_numbers.png Eric Thomas, 2010-04-06 15:34
syntax_highlighter.png (49.4 KB) syntax_highlighter.png Screenshot of 3 updates Eric Thomas, 2010-04-14 06:05
syntax_highlighter_patch.diff (5.07 KB) syntax_highlighter_patch.diff Line Number patch Eric Thomas, 2010-04-14 06:05

Related issues

Related to Redmine - Feature #4267: <code> block improvementsNew2009-11-23

Actions
Related to Redmine - Feature #4264: Update CodeRay to 1.0 finalClosed

Actions
Related to Redmine - Defect #36580: Fix code copying in common browsersClosedGo MAEDA

Actions
Has duplicate Redmine - Feature #8578: Code selection shouldn't get line numbersClosed2011-06-09

Actions
Has duplicate Redmine - Feature #9613: Line numbers copied in repository file viewClosed2011-11-20

Actions
Has duplicate Redmine - Feature #14469: change source code browser's html layoutClosed

Actions
Blocked by Redmine - Feature #8255: Consider updating CodeRay to 1.0 RC-xClosed

Actions
Actions #1

Updated by Nelson LaQuet almost 15 years ago

+1

This bugs me as well

Actions #2

Updated by Abhi Beckert over 14 years ago

I have personally hacked app/views/wiki/show.rhtml to have this at the end of the page:

<script type="text/javascript">
  if ($$('.CodeRay .no').length > 0) {
    document.write('<p><a href="javascript:$$(\'.CodeRay .no\').each(function(el) { el.hide(); });">Hide Line No\'s in code snippets</a></p>');
  }
</script>

This will create a Hide Line No's in code snippet link, I add it above the attachment html, after the page content (note: it must be after the content, or it won't work).

Actions #3

Updated by Josh Galvez almost 14 years ago

I notice that on the coderay website, their examples can be copied without line numbers.
http://coderay.rubychan.de/

Actions #4

Updated by Josh Galvez almost 14 years ago

at r3608 you need to add:

<script type="text/javascript">
  if ($$('.syntaxhl .no').length > 0) {
      document.write('<p class="other-formats"><a href="javascript:$$(\'.syntaxhl .no\').each(function(el) { el.hide(); });">Hide Line No\'s in code snippets</a></p>');
  }
</script>

I put it in app/views/issues/show.rhtml, immediately before: <% other_formats_links do |f| %>

Actions #5

Updated by Kornelius Kalnbach almost 14 years ago

Yes, CodeRay allows copy-friendly, line-numbered code via the :line_numbers => :table option. It has problems, too, but it's the preferred method.

Actions #6

Updated by Eric Thomas almost 14 years ago

Has anybody tried a fix for this.

Kornelius's fix should be in lib/redmine/syntax_highlighting.rb, changing

def highlight_by_language(text, language)
  ::CodeRay.scan(text, language).html(:line_numbers => :inline)
end

to

def highlight_by_language(text, language)
  ::CodeRay.scan(text, language).html(:line_numbers => :table)
end

however, the current stylesheet doesn't define anything for table attributes for the syntax CSS class so rendering produces something like the attached screenshot.

Actions #7

Updated by Kornelius Kalnbach almost 14 years ago

By the way, CodeRay 1.0 will have the :line_number_anchors option, too. Maybe it helps to find a solution. There's no release date for 1.0 set yet.

Actions #8

Updated by Eric Thomas almost 14 years ago

So I sort of got this to work...

Please look at the screenshot first:
  • The first update it highlighting the text without the numbers
  • The second update shows it with the line numbers toggled.
  • The third is it wrapped inside a pre tag (the other two aren't, but should be), and there's a little bit of space around the table on the top and right side, and a lot of space under the table.

I have provided a patch. However, the CSS is not set up properly.
For some reason, I could not get the .syntaxhl table to work, so I had to use table.CodeRay as the identifier.

Actions #9

Updated by Kornelius Kalnbach almost 14 years ago

Would it be helpful to add an option for the name of the CSS class to the HTML encoder? It would default to ".CodeRay", but could be changed to ".syntaxhl" for Redmine.

Actions #10

Updated by Eric Thomas almost 14 years ago

Kornelius Kalnbach wrote:

Would it be helpful to add an option for the name of the CSS class to the HTML encoder? It would default to ".CodeRay", but could be changed to ".syntaxhl" for Redmine.

That wouldn't quite make any sense sense it would say <table class="CodeRay"> Can any CSS expert chime in here? The output right now with the inline option is:

<pre><code class="ruby syntaxhl"><span class="CodeRay">....</span></code></pre>

By using the table option:

<pre><code class="ruby syntaxhl"><table class="CodeRay">...</table></code></pre>

So the only thing that changed was changing the span to table. Trying to do the following doesn't take effect, not sure why.

.syntax table {
  some random attributes....
}

Actions #11

Updated by Eric Thomas almost 14 years ago

Whoops for some reason what I said got picked up by the parser :)

Kornelius, if one were to change it to syntaxhl then it would declare the class for both the code/span tag which would be redundant.

Can any CSS experts help out here?

Actions #12

Updated by Andrew Brock about 13 years ago

Eric Hulser,

I've tested your patch and I would put it onto my Redmine production machine except for one thing. For code snippets of > 30 lines the line numbers don't match up with the code anymore. At ~35 lines the line number is roughly one line before the line it references and at roughly 70 lines the line numbers are two lines ahead of the code.

I should note that I'm patching against an already heavily modified snapshot of my production install so it could be that.

Unfortunately I'm not a CSS expert (or even a novice) so I can't help in that area.

Actions #13

Updated by Etienne Massip almost 13 years ago

  • Target version set to Candidate for next major release
Actions #14

Updated by Not Needed over 12 years ago

what's the status on this?

Actions #15

Updated by Etienne Massip about 12 years ago

  • Target version changed from Candidate for next major release to 1.4.0

Fixed with r8541, requires a browser supporting the user-select CSS3 rule.

From what I know and see, FF supports it well now, Chrome still copy the line numbers and IE10 should support it but not tried.

Actions #16

Updated by Etienne Massip about 12 years ago

  • Target version changed from 1.4.0 to Candidate for next major release

This actually is a temporary fix as the css3-ui specification has dropped the user-select property.

Actions #17

Updated by Not Needed about 12 years ago

For now I have added the code below to scm.css on elemen .syntaxhl .no and works, even in chrome.

        user-select: none;
        -moz-user-select: none;
        -o-user-select: none;
        -ms-user-select: none;
        -webkit-user-select: none;

Basically, in a future version of redmine, CodeRay should be updated, since they've incoperated a solution that works without -user-select. Take a look at the example-page: [[http://coderay.rubychan.de/rays#n7]]. An even better solution would be if it were possible to install your own highlighters.

Actions #18

Updated by Etienne Massip about 12 years ago

Not Needed wrote:

For now I have added the code below to scm.css on elemen .syntaxhl .no and works, even in chrome.

In my version of Chromium (17 and some bananas (French expression)), the selection is visually Ok but copying & pasting in a text editor would paste line numbers too.

Besides, it seems that Firefox has recently updated its code and, according to MDN definition of none value, could copy Chrome behaviour.

So I plan to revert this change.

Basically, in a future version of redmine, CodeRay should be updated, since they've incoperated a solution that works without -user-select. Take a look at the example-page: [[http://coderay.rubychan.de/rays#n7]]. An even better solution would be if it were possible to install your own highlighters.

CodeRay version 1.0 has been integrated into Redmine and already allow this.
The problem with the way CodeRay displays rays is that it doesn't allow line wrapping because it basically renders a table containing a tr and a th for line numbers and a td for code.

That would be a regression.

There is a way to fix this issue properly but this requires that CodeRay fixes this issue first.

Actions #19

Updated by rm user over 11 years ago

Any update on this?

I'm on 1.3 stable redmine still. Is there a workaround for FF 13 & latest Chrome?

Tried suggested fix with user-select but it didn't work out.

Thanks

Actions #20

Updated by Roger Hunwicks over 11 years ago

For me, the user-select fix doesn't look like it is working, but in fact it does.

What I mean is that when I select text I get the full table, including the line numbers, but when I paste it I get just the code, which is what I want.

Actions #21

Updated by rm user over 11 years ago

Roger Hunwicks wrote:

For me, the user-select fix doesn't look like it is working, but in fact it does.

What I mean is that when I select text I get the full table, including the line numbers, but when I paste it I get just the code, which is what I want.

I got this working, but FF still selects numbers tho :( If you copy from FF text is correct however.

Would be good to have final solution, examples on Coderays website works just fine for me.

Actions #22

Updated by rm user over 11 years ago

Chrome selects text just fine with this hack, but on copy it copies numbers as well.

Firefox copies without numbers but with blank lines between code lines. When you select in Firefox numbers also selected.

Such a nasty bug... Almost 3 years and still no fix! :(

Actions #23

Updated by Kornelius Kalnbach over 11 years ago

Hi, CodeRay maintainer here ;) Sorry, I have to catch up to this…so, we have:

  • :line_numbers => :table, which successfully prevents you from selecting the line numbers while copying on all browsers (right?)
  • :line_numbers => :inline, which allows line breaking, but behaves strange on some browsers when it comes to line number selection/copying

I try to mark this piece of code with my mouse completely:

One :line
another "line" 
  • In Firefox, it marks the "2" (bad), but doesn't copy it (good).
  • In Chrome and Safari, it doesn't mark the numbers (good), but copies it (wrong - WTF Webkit?).
  • I did not try IE.

I would suggest using :table. Unfortunately, the table implementation CodeRay uses does not allow lines to be wrapped. But what is the benefit in line wrapping anyway?

Actions #24

Updated by rm user over 11 years ago

Kornelius Kalnbach wrote:

I try to mark this piece of code with my mouse completely:

[...]

  • In Firefox, it marks the "2" (bad), but doesn't copy it (good).
  • In Chrome and Safari, it doesn't mark the numbers (good), but copies it (wrong - WTF Webkit?).
  • I did not try IE.

in IE it selects numbers and does copy numbers.

I would suggest using :table. Unfortunately, the table implementation CodeRay uses does not allow lines to be wrapped. But what is the benefit in line wrapping anyway?

Thanks for the update, but it's not working for me with table directive in redmine, I'm having same result as you, probably due wrapping. Also copying in firefox adds additional blank lines between lines..

Actions #25

Updated by Etienne Massip over 11 years ago

Kornelius Kalnbach wrote:

Hi, CodeRay maintainer here ;) Sorry, I have to catch up to this…so, we have:

  • :line_numbers => :table, which successfully prevents you from selecting the line numbers while copying on all browsers (right?)
  • :line_numbers => :inline, which allows line breaking, but behaves strange on some browsers when it comes to line number selection/copying

I try to mark this piece of code with my mouse completely:

[...]

  • In Firefox, it marks the "2" (bad), but doesn't copy it (good).
  • In Chrome and Safari, it doesn't mark the numbers (good), but copies it (wrong - WTF Webkit?).
  • I did not try IE.

Whatever, user-select, which BTW is no more part of CSS3 specification, is supposed to work this way (having only a visual effect ).

I would suggest using :table. Unfortunately, the table implementation CodeRay uses does not allow lines to be wrapped. But what is the benefit in line wrapping anyway?

Well, it is common use with Redmine to browse code contents in files that can be easily big enough so that wrapping lines is pretty more confortable than paging down to the bottom of the file were we'd find the horizontal scroller and paging up back to the line.

I've done some trials to keep wrapping with :inline and have only code selected but nothing really worked for now, if you have some suggestion...

Actions #26

Updated by rm user over 11 years ago

Etienne Massip wrote:

Kornelius Kalnbach wrote:

Hi, CodeRay maintainer here ;) Sorry, I have to catch up to this…so, we have:

  • :line_numbers => :table, which successfully prevents you from selecting the line numbers while copying on all browsers (right?)
  • :line_numbers => :inline, which allows line breaking, but behaves strange on some browsers when it comes to line number selection/copying

I try to mark this piece of code with my mouse completely:

[...]

  • In Firefox, it marks the "2" (bad), but doesn't copy it (good).
  • In Chrome and Safari, it doesn't mark the numbers (good), but copies it (wrong - WTF Webkit?).
  • I did not try IE.

Whatever, user-select, which BTW is no more part of CSS3 specification, is supposed to work this way (having only a visual effect ).

I would suggest using :table. Unfortunately, the table implementation CodeRay uses does not allow lines to be wrapped. But what is the benefit in line wrapping anyway?

Well, it is common use with Redmine to browse code contents in files that can be easily big enough so that wrapping lines is pretty more confortable than paging down to the bottom of the file were we'd find the horizontal scroller and paging up back to the line.

I've done some trials to keep wrapping with :inline and have only code selected but nothing really worked for now, if you have some suggestion...

I did some more testings:

  • Opera - doesn't copy line numbers / DOES select
  • Firefox - doesn't copy line numbers, BUT does insert blank lines between lines / DOES select
  • Chrome - DOES copy line numbers / doesn't select
  • IE - DOES copy line numbers / DOES select

Any idea how to make it work in ALL browsers?

Thanks

Actions #27

Updated by Kornelius Kalnbach over 11 years ago

wrapping lines is pretty more confortable than paging down to the bottom of the file were we'd find the horizontal scroller and paging up back to the line.

Your computer/os/mouse/trackpad doesn't support horizontal scrolling? Wow…never thought about that. It's super easy on a Mac.

Well, I don't see how we can have both. table allows for selecting lines without numbers, but not for line wrapping (because the line number column would not match with the code lines any more). inline could wrap, but copies line numbers because user-select is non-standard and doesn't work as needed.

Seems to come down to a decision which is less problematic: Either you leave the line numbers out, or you stick with horizontal scrolling.

Actions #28

Updated by rm user over 11 years ago

Kornelius Kalnbach wrote:

wrapping lines is pretty more confortable than paging down to the bottom of the file were we'd find the horizontal scroller and paging up back to the line.

Your computer/os/mouse/trackpad doesn't support horizontal scrolling? Wow…never thought about that. It's super easy on a Mac.

Well, I don't see how we can have both. table allows for selecting lines without numbers, but not for line wrapping (because the line number column would not match with the code lines any more). inline could wrap, but copies line numbers because user-select is non-standard and doesn't work as needed.

Seems to come down to a decision which is less problematic: Either you leave the line numbers out, or you stick with horizontal scrolling.

thanks for the update Kornelius!

what about github? does it use line-wrapping ? really need it solved, this issue has been for 4 years - so sucks :(

EDIT: yes, github DOES not use line-wrapping. (example: https://github.com/kubitron/redmine_git_hosting/blob/master/init.rb). Any idea how to hack redmine to make it work without wrapping and using tables? I did change coderay to line-numbers => :table but it didn't work for me still the same effect.. I'm on redmine 1.4.

Redmine really lacks of user feedback (or ignores it?). Quite sure lots of redmine users would find helpful proper code highlighting even without wrapping.. Or maybe integrate into core a switch which gives you opportunity to select what to use line-wrapping or not..
Maybe someone could write a plugin to make redmine 'not wrap lines' ? (i'm not good in ruby unfortunately).

Actions #29

Updated by Naomasa Takasaki over 11 years ago

Hello everyone.

I hacked and solved this problem.

Correct this file.
file:
[redminedir]/app/views/repositories/_link_to_functions.rhtml

<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
----add under here-----
<script type="text/javascript">
function row_hidden(){
var elements = document.getElementsByClassName("line-num");
for (var i=0;i<elements.length; i++){
elements[i].style.visibility='hidden';
}
}
function row_visible(){
var elements = document.getElementsByClassName("line-num");
for (var i=0;i<elements.length; i++){
elements[i].style.visibility='visible';
}
}
</script>

| row number:
<a href="#" onclick="row_visible();">show</a>/
<a href="#" onclick="row_hidden();">hide</a>

Actions #30

Updated by rm user over 11 years ago

Naomasa Takasaki wrote:

Hello everyone.

I hacked and solved this problem.

Correct this file.
file:
[redminedir]/app/views/repositories/_link_to_functions.rhtml

<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
----add under here-----
<script type="text/javascript">
function row_hidden(){
var elements = document.getElementsByClassName("line-num");
for (var i=0;i<elements.length; i++){
elements[i].style.visibility='hidden';
}
}
function row_visible(){
var elements = document.getElementsByClassName("line-num");
for (var i=0;i<elements.length; i++){
elements[i].style.visibility='visible';
}
}
</script>

| row number:
<a href="#" onclick="row_visible();">show</a>/
<a href="#" onclick="row_hidden();">hide</a>

thanks for this it worked, except, there is blank lines between copied lines.

any idea how to fix this?

Actions #31

Updated by Naomasa Takasaki over 11 years ago

thanks for this it worked, except, there is blank lines between copied lines.
any idea how to fix this?

Please wait. I try correction of the code.
Probably i will remove line-num tags.

and In a Chrome Browser, a blank and a row number are nothing and commit the code.

Actions #32

Updated by rm user over 11 years ago

Naomasa Takasaki wrote:

thanks for this it worked, except, there is blank lines between copied lines.
any idea how to fix this?

Please wait. I try correction of the code.
Probably i will remove line-num tags.

and In a Chrome Browser, a blank and a row number are nothing and commit the code.

Yes, in chrome it works just fine - happens for me in Firefox.

Chrome stips ALL blank lines, even blank lines in original code.

Opera - works fine.

IE 9 - 4 blank lines between code lines

Actions #33

Updated by Naomasa Takasaki over 11 years ago

please try this code.
this code was tested using IE8,Chrome,Firefox,safari and redmine 1.2.1.

[redmine dir]/app/views/repositories/_link_to_functions.rhtml

<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
---add under here---
<script type="text/javascript">
function row_hidden(){
var syntaxhl_on  = document.getElementById("syntaxhl_on");
var syntaxhl_off = document.getElementById("syntaxhl_off");
syntaxhl_on.style.display='none';
syntaxhl_off.style.display='block';
}

function row_visible(){
var syntaxhl_on  = document.getElementById("syntaxhl_on");
var syntaxhl_off = document.getElementById("syntaxhl_off");
syntaxhl_on.style.display='block';
syntaxhl_off.style.display='none';
}
</script>

| row number:
<a href="#" onclick="row_visible();">show</a>/
<a href="#" onclick="row_hidden();">hide</a>
---add above here---
</p>
<% end %>

[redmine dir]/app/views/common/_file.rhtml

<div class="autoscroll">
<table class="filecontent syntaxhl">
<tbody>
<% line_num = 1 %>
<% syntax_highlight(filename, to_utf8(content)).each_line do |line| %>
<tr><th class="line-num" id="L<%= line_num %>"><a href="#L<%= line_num %>"><%= line_num %></a></th><td class="line-code"><pre><%= line %></pre></td></tr>
<% line_num += 1 %>
<% end %>
</tbody>
</table>
</div>


<div class="autoscroll">
<div id="syntaxhl_on" style="display:block">
<table class="filecontent syntaxhl">
<tbody>
<% line_num = 1 %>
<% syntax_highlight(filename, to_utf8(content)).each_line do |line| %>
<tr><th class="line-num" id="L<%= line_num %>"><a href="#L<%= line_num %>"><%= line_num %></a></th><td class="line-code"><pre><%= line %></pre></td></tr>
<% line_num += 1 %>
<% end %>
</tbody>
</table>
</div>
<div id="syntaxhl_off" style="display:none">
<table class="filecontent syntaxhl">
<tbody>
<tr>
<th style="display:none"></th>
<td class="line-code">
<pre>
<%= content %>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
Actions #34

Updated by rm user over 11 years ago

Naomasa Takasaki wrote:

please try this code.
this code was tested using IE8,Chrome,Firefox,safari and redmine 1.2.1.

[redmine dir]/app/views/repositories/_link_to_functions.rhtml
[...]

[redmine dir]/app/views/common/_file.rhtml

[...]</td></tr>
<% line_num += 1 >
<
end >
</tbody>
</table>
</div>


[...]</td></tr>
<
line_num += 1 >
<
end %>
</tbody>
</table>
</div>
<div id="syntaxhl_off" style="display:none">
<table class="filecontent syntaxhl">
<tbody>
<tr>
<th style="display:none"></th>
<td class="line-code">
[...]
</td>
</tr>
</tbody>
</table>
</div>
</div>

Thanks it works, but it's not working in code blocks paste into issue or wiki etc.

i.e. with

<pre><code class="ruby">sdsds dsds</code>

Actions #35

Updated by Naomasa Takasaki over 11 years ago

The code is running only in repository.
you should upgrade javascript syntaxhighlight plugin.

Actions #36

Updated by rm user over 11 years ago

Naomasa Takasaki wrote:

The code is running only in repository.
you should upgrade javascript syntaxhighlight plugin.

I'm already on the latest 1.4 redmine. What do I need to do? Could you point me exactly?

Actions #37

Updated by Naomasa Takasaki over 11 years ago

Don't worry.

I am already works in code blocks paste into issue or wiki etc on redmine 1.2.1.

Please go to SyntaxHighlighter official website and get newest Syntaxhighlighter plugin.

http://alexgorbatchev.com/SyntaxHighlighter/

please copy:
[download zip file]/styles/* to [redmine]/public/stylesheets/
[download zip file]/scripts/* to [redmine]/public/javascripts/

register this code near an alike code:
[redminedir]/vendor/plugins/redmine_js_syntax_highlighter/lib/syntaxhighlighter.rb

o << javascript_include_tag("/javascripts/shBrushRuby.js")
o << javascript_include_tag("/javascripts/shBrush****.js")

please restart httpd.

change code syntax:
<pre class="brush: ruby">
puts "Hello World"
</pre>

and please write this code wiki or etc..
(This code does not work in preview mode.)

Actions #38

Updated by rm user over 11 years ago

Naomasa Takasaki wrote:

Don't worry.

I am already works in code blocks paste into issue or wiki etc on redmine 1.2.1.

Please go to SyntaxHighlighter official website and get newest Syntaxhighlighter plugin.

http://alexgorbatchev.com/SyntaxHighlighter/

please copy:
[download zip file]/styles/* to [redmine]/public/stylesheets/
[download zip file]/scripts/* to [redmine]/public/javascripts/

register this code near an alike code:
[redminedir]/vendor/plugins/redmine_js_syntax_highlighter/lib/syntaxhighlighter.rb

o << javascript_include_tag("/javascripts/shBrushRuby.js")
o << javascript_include_tag("/javascripts/shBrush****.js")

please restart httpd.

change code syntax:
<pre class="brush: ruby">
puts "Hello World"
</pre>

and please write this code wiki or etc..
(This code does not work in preview mode.)

Thanks a lot will try this bit later!

Actions #39

Updated by rm user over 11 years ago

hi! thanks again for this suggestion, but it's bit not comfort to use custom <pre class> instead of the usual <code> block.

could you make it work using standard <code> block ?

Actions #40

Updated by Naomasa Takasaki over 11 years ago

code tag should be replaced with script tag.

http://alexgorbatchev.com/SyntaxHighlighter/manual/installation.html

but, in redmine ,script tag is not works.

probably,redmine syntaxhighlighter plugin,It does not correspond to the newest version of syntaxhighlighter.

https://github.com/k2s/redmine_js_syntax_highlighter/blob/master/lib/syntaxhighlighter.rb

The comment about a script tag is not found in the code.

Actions #41

Updated by rm user over 11 years ago

Naomasa Takasaki wrote:

code tag should be replaced with script tag.

http://alexgorbatchev.com/SyntaxHighlighter/manual/installation.html

but, in redmine ,script tag is not works.

probably,redmine syntaxhighlighter plugin,It does not correspond to the newest version of syntaxhighlighter.

https://github.com/k2s/redmine_js_syntax_highlighter/blob/master/lib/syntaxhighlighter.rb

The comment about a script tag is not found in the code.

does it load .js files from alexgorbachev's site? would really like standalone-solution so I don't need to load any 3rd party files from websites, especially if redmine installed inside the local area.

sorry, if i'm sounding too much demanding :) your solution with hide/show so far working great for me in repository view (althrough it's still to be considered a dirty hack).

i'm still waiting for redmine maintainers to look at this issue closer and make relevant changes inside redmine's core system.

Actions #42

Updated by rm user over 11 years ago

even if i will use the proposed syntax highlighter if I try to use diff between revisions lines would be still copied :(

so needs a solution which will fix this in the redmine's core.

Actions #43

Updated by Terence Mill over 11 years ago

+1

Actions #44

Updated by rm user almost 11 years ago

installed latest stable 2.2.4

issue is still happening here

any update?

Actions #45

Updated by Mischa The Evil almost 11 years ago

AFAIK line numbering is removed from CodeRay syntax highlighting completely with r10131 (first included in Redmine 2.1.0).

Actions #46

Updated by Etienne Massip almost 11 years ago

Mischa The Evil wrote:

AFAIK line numbering is removed from CodeRay syntax highlighting completely with r10131 (first included in Redmine 2.1.0).

Sure but Redmine itself generates line numbers and you still can't copy/paste without pasting them along with the selected source code.

Actions #47

Updated by rm user almost 11 years ago

I don't want to sound like a b*tch, but why all these new versions for ?

If basic bugs like this, cant be fixed and need to use workarounds for that .. :/

Actions #48

Updated by Etienne Massip almost 11 years ago

rm user wrote:

I don't want to sound like a b*tch, but why all these new versions for ?

What versions are you talking about?

If basic bugs like this, cant be fixed and need to use workarounds for that .. :/

This bug may look basic but is actually a bit tricky, do you have a neat fix for this? I mean, without changing actual default theme behavior which is that lines can be wrapped?

Actions #49

Updated by rm user almost 11 years ago

Etienne Massip wrote:

rm user wrote:

I don't want to sound like a b*tch, but why all these new versions for ?

What versions are you talking about?

I mean there are new versions coming 2.0, 2.1, 2.2, now 2.3 in development..

If basic bugs like this, cant be fixed and need to use workarounds for that .. :/

This bug may look basic but is actually a bit tricky, do you have a neat fix for this? I mean, without changing actual default theme behavior which is that lines can be wrapped?

I understand the issue is bit harder, the only fix that worked for me so far in the repo code is http://www.redmine.org/issues/3382#note-33

but you need to click each time before you copy anything.

Actions #50

Updated by rm user almost 11 years ago

any comments on the above?

Actions #51

Updated by Etienne Massip almost 11 years ago

rm user wrote:

any comments on the above?

Not really; #3382#note-33 proposal is JavaScript and not what I was thinking when I talked about a neat fix, sounds more like overkill to me.

Actions #52

Updated by Christoph Dwertmann almost 11 years ago

I created a plugin that turns line numbering back on and adds a toggle to each page to turn it off (for copy & paste):
http://www.redmine.org/plugins/line_numbers

Enjoy!

Actions #53

Updated by Toshi MARUYAMA over 10 years ago

  • Has duplicate Feature #14469: change source code browser's html layout added
Actions #54

Updated by Anonymous over 10 years ago

+1

Actions #55

Updated by rm user over 10 years ago

+100500 !!!

still not fixed, had to use workaround :/

Actions #56

Updated by Anonymous about 10 years ago

+2

Actions #57

Updated by Billy T over 9 years ago

This is not a feature. This is really a bug!
+infinity

Actions #59

Updated by Go MAEDA about 2 years ago

  • Related to Defect #36580: Fix code copying in common browsers added
Actions #60

Updated by Go MAEDA about 2 years ago

  • Status changed from New to Closed
  • Target version deleted (Candidate for next major release)
  • Resolution set to Duplicate

Vitaly vit9696 wrote:

Patch posted in https://www.redmine.org/issues/36580.

Committed the patch in r21415 for the upcoming Redmine 5.0.0. Thank you.

Actions

Also available in: Atom PDF