Python Forum
strange change of the indention to 3 spaces
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
strange change of the indention to 3 spaces
#21
def foo():
"""This is just some dummy code"""
  
   a=0
   for n in range(10):
       a+=n
   return a
Ah ok. Now i see it. It only happens from quick reply converting to advanced editor via preview post.
Recommended Tutorials:
Reply
#22
its got to be something with default MyBB as i had it happen when i was trying to make a post explaining the situation...except i was having it happen in the advanced editor and quick reply editor there with just plain text no code tags.
Recommended Tutorials:
Reply
#23
It's the same behavior in Mybb community forum,
always lose 1-indent from Quick Reply when clicking Preview Post button.
So maybe it has always been like that Think
Reply
#24
(May-19-2017, 11:31 PM)metulburr Wrote: It only happens from quick reply converting to advanced editor via preview post
quick reply + preview is same as full edit or moderate. i.e. the problem is when preview a post (already published or draft quick reply) in full edit mode (incl. moderate). Note that it affects all post with moderator note that have code with indentation.
Reply
#25
(May-20-2017, 12:11 AM)snippsat Wrote: So maybe it has always been like that Think

Ya maybe but for python indentation is critical Undecided

Thinking about it, whether there are 3 or 4 indentation spaces in first level seems rather un-critical after all, just so long as it stays consistent withing the same code piece
(May-19-2017, 04:18 PM)metulburr Wrote: both python and code tags are linked to the same syntax highlighter code, so im not sure why one would do it and the other would not. Though i cant really test it as i cant replicate it.

But you do see that only one of them renders in full-edit-view right?
Reply
#26
(May-23-2017, 10:13 AM)Kebap Wrote: Thinking about it, whether there are 3 or 4 indentation spaces in first level seems rather un-critical after all, just so long as it stays consistent withing the same code piece

however it doesn't if there is more than one level of indentation.
Also, even with one level, if someone copy paste code from here in his/her more large project, it will be inconsistent with the rest of the code (assuming PEP8 compliance and 4 indentations)
Reply
#27
(May-23-2017, 10:13 AM)Kebap Wrote: Thinking about it, whether there are 3 or 4 indentation spaces in first level seems rather un-critical after all, just so long as it stays consistent withing the same code piece
Regardless I would like to get to the bottom of why its happening in the first place. However the fact that no one has yet replied to my question on the support forums leads me to believe that I will get no help from them on this problem.

(May-23-2017, 10:13 AM)Kebap Wrote: But you do see that only one of them renders in full-edit-view right?

The code tags show differently within the editor because MyBB is using them by default. I think there is somewhere in one of the editor config files it defines code tags as to display differently in the editor...in which makes a distinct difference in the editor...but shoudlnt in the actual post at all. And it shouldnt add or remove whitespace at all.

I asked another question on the forums in a different way to try to pinpoint this config file to have a look at what the editor might be doing to the code.
Recommended Tutorials:
Reply
#28
(May-23-2017, 10:52 AM)metulburr Wrote: which makes a distinct difference in the editor...but shoudlnt in the actual post at all. And it shouldnt add or remove whitespace at all.

The error originates in the editor. This is where the python box code shows with 3 instead of 4 spaces for the first time.
Reply
#29
all originally 3 spaced. Seeing if this happens after removing WYSIWYG editor

NO TAGS showing in preview no indentation whatsoever
def foo():
"""This is just some dummy code"""
 
  a=0
  for n in range(10):
      a+=n
  return a
PYTHON TAGS showing in preview 3 spaces
def foo():
"""This is just some dummy code"""
  
  a=0
  for n in range(10):
      a+=n
  return a
CODE TAGS showing in preview 3 spaces
def foo():
"""This is just some dummy code"""
   
   a=0
   for n in range(10):
       a+=n
   return a
Recommended Tutorials:
Reply
#30
OK dumb thought..... Shocked

We initially made python tags because we used code tags and python tags side by side. code tags were for the default code box, while python tags were for our syntax highlighter codebox. Now we switched code tags to use our highlighter box as well. So python and code tags are resulting in the same thing. However somewhere in their mybb code they dont degrade code tags while they do with python tags or no tags (removing one space).

What if we just convert the python code button to use code tags.
For one, everyone on forums knows code to be in code tags, and secondly we would completely remove this problem due to mybb not altering whatever is in code tags.
Recommended Tutorials:
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020